author | hgs |
Fri, 23 Jul 2010 11:35:41 +0300 | |
changeset 45 | 24fd82631616 |
parent 28 | 3075d9b614e6 |
permissions | -rw-r--r-- |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
45 | 2 |
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
45 | 18 |
#include <QRegExp> |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <ecamadvsettingsuids.hrh> |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "cxeautofocuscontrol.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "cxesettingsmappersymbian.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "cxutils.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "cxenamespace.h" |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
using namespace Cxe; |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
|
45 | 28 |
|
29 |
||
30 |
/*! |
|
31 |
Map Cxe::Whitebalance value to its corresponding CCamera value. |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
*/ |
45 | 33 |
CCamera::TWhiteBalance CxeSettingsMapperSymbian::Map2CameraWb( |
34 |
Cxe::Whitebalance whiteBalance ) |
|
35 |
{ |
|
36 |
CCamera::TWhiteBalance wb(CCamera::EWBAuto); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
|
45 | 38 |
switch (whiteBalance) { |
39 |
case WhitebalanceSunny: |
|
40 |
wb = CCamera::EWBDaylight; |
|
41 |
break; |
|
42 |
case WhitebalanceCloudy: |
|
43 |
wb = CCamera::EWBCloudy; |
|
44 |
break; |
|
45 |
case WhitebalanceIncandescent: |
|
46 |
wb = CCamera::EWBTungsten; |
|
47 |
break; |
|
48 |
case WhitebalanceFluorescent: |
|
49 |
wb = CCamera::EWBFluorescent; |
|
50 |
break; |
|
51 |
case WhitebalanceAutomatic: |
|
52 |
default: |
|
53 |
wb = CCamera::EWBAuto; |
|
54 |
break; |
|
55 |
} |
|
56 |
return wb; |
|
57 |
} |
|
58 |
||
59 |
||
60 |
/*! |
|
61 |
Map Cxe::FlashMode to its corresponding CCamera value. |
|
62 |
*/ |
|
63 |
CCamera::TFlash CxeSettingsMapperSymbian::Map2CameraFlash( |
|
64 |
Cxe::FlashMode flashMode) |
|
65 |
{ |
|
66 |
CCamera::TFlash flash(CCamera::EFlashAuto); |
|
67 |
||
68 |
switch (flashMode) { |
|
69 |
case FlashAntiRedEye: |
|
70 |
flash = CCamera::EFlashRedEyeReduce; |
|
71 |
break; |
|
72 |
case FlashOn: |
|
73 |
flash = CCamera::EFlashForced; |
|
74 |
break; |
|
75 |
case FlashOff: |
|
76 |
flash = CCamera::EFlashNone; |
|
77 |
break; |
|
78 |
case FlashAuto: |
|
79 |
default: |
|
80 |
flash = CCamera::EFlashAuto; |
|
81 |
break; |
|
82 |
} |
|
83 |
return flash; |
|
84 |
} |
|
85 |
||
86 |
||
87 |
/*! |
|
88 |
Map Cxe::ExposureMode to its corresponding CCamera value. |
|
89 |
*/ |
|
90 |
CCamera::TExposure CxeSettingsMapperSymbian::Map2CameraExposureMode( |
|
91 |
Cxe::ExposureMode exposureMode) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
{ |
45 | 93 |
CCamera::TExposure expo(CCamera::EExposureAuto); |
94 |
||
95 |
switch (exposureMode) { |
|
96 |
case ExposureNight: |
|
97 |
expo = CCamera::EExposureNight; |
|
98 |
break; |
|
99 |
case ExposureBacklight: |
|
100 |
expo = CCamera::EExposureBacklight; |
|
101 |
break; |
|
102 |
case ExposureSport: |
|
103 |
expo = CCamera::EExposureSport; |
|
104 |
break; |
|
105 |
case ExposureAuto: |
|
106 |
default: |
|
107 |
expo = CCamera::EExposureAuto; |
|
108 |
break; |
|
109 |
} |
|
110 |
||
111 |
return expo; |
|
112 |
} |
|
113 |
||
114 |
||
115 |
/*! |
|
116 |
Map Cxe::ExposureMode to its corresponding CCamera value. |
|
117 |
*/ |
|
118 |
CCamera::CCameraImageProcessing::TEffect |
|
119 |
CxeSettingsMapperSymbian::Map2CameraEffect(Cxe::Colortone colorTone) |
|
120 |
{ |
|
121 |
CCamera::CCameraImageProcessing::TEffect effect( |
|
122 |
CCamera::CCameraImageProcessing::EEffectNone); |
|
123 |
||
124 |
switch(colorTone) { |
|
125 |
case ColortoneBlackAndWhite: |
|
126 |
effect = CCamera::CCameraImageProcessing::EEffectMonochrome; |
|
127 |
break; |
|
128 |
case ColortoneSepia: |
|
129 |
effect = CCamera::CCameraImageProcessing::EEffectSepia; |
|
130 |
break; |
|
131 |
case ColortoneNegative: |
|
132 |
effect = CCamera::CCameraImageProcessing::EEffectNegative; |
|
133 |
break; |
|
134 |
case ColortoneVivid: |
|
135 |
effect = CCamera::CCameraImageProcessing::EEffectVivid; |
|
136 |
break; |
|
137 |
case ColortoneNormal: |
|
138 |
default: |
|
139 |
effect = CCamera::CCameraImageProcessing::EEffectNone; |
|
140 |
break; |
|
141 |
} |
|
142 |
return effect; |
|
143 |
} |
|
144 |
||
145 |
/*! |
|
146 |
Map CxeAutoFocusControl::Mode to its corresponding CCamera value. |
|
147 |
*/ |
|
148 |
CCamera::CCameraAdvancedSettings::TFocusRange |
|
149 |
CxeSettingsMapperSymbian::Map2CameraAutofocus(CxeAutoFocusControl::Mode afMode) |
|
150 |
{ |
|
151 |
CCamera::CCameraAdvancedSettings::TFocusRange value; |
|
152 |
||
153 |
switch (afMode) { |
|
154 |
case CxeAutoFocusControl::Macro: |
|
155 |
value = CCamera::CCameraAdvancedSettings::EFocusRangeMacro; |
|
156 |
break; |
|
157 |
case CxeAutoFocusControl::Portrait: |
|
158 |
value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto; |
|
159 |
break; |
|
160 |
case CxeAutoFocusControl::Infinity: |
|
161 |
value = CCamera::CCameraAdvancedSettings::EFocusRangeInfinite; |
|
162 |
break; |
|
163 |
case CxeAutoFocusControl::Hyperfocal: |
|
164 |
value = CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal; |
|
165 |
break; |
|
166 |
case CxeAutoFocusControl::Auto: // Fall through |
|
167 |
default: |
|
168 |
value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto; |
|
169 |
break; |
|
170 |
} |
|
171 |
return value; |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
} |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
173 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
|
45 | 176 |
/*! |
177 |
Map Cxe::DeviceOrientation to MCameraOrientation. |
|
178 |
*/ |
|
179 |
MCameraOrientation::TOrientation |
|
180 |
CxeSettingsMapperSymbian::Map2CameraOrientation(Cxe::DeviceOrientation |
|
181 |
uiOrientation) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
{ |
45 | 183 |
MCameraOrientation::TOrientation cameraOrientation; |
184 |
||
185 |
switch (uiOrientation) { |
|
186 |
case Orientation90: |
|
187 |
cameraOrientation = MCameraOrientation::EOrientation90; |
|
188 |
break; |
|
189 |
case Orientation180: |
|
190 |
cameraOrientation = MCameraOrientation::EOrientation180; |
|
191 |
break; |
|
192 |
case Orientation270: |
|
193 |
cameraOrientation = MCameraOrientation::EOrientation270; |
|
194 |
break; |
|
195 |
case Orientation0: // default |
|
196 |
default: |
|
197 |
cameraOrientation = MCameraOrientation::EOrientation0; |
|
198 |
break; |
|
199 |
} |
|
200 |
return cameraOrientation; |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
} |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
|
45 | 203 |
/*! |
204 |
Helper data structure to define how MIME types are mapped to |
|
205 |
MCameraUseCaseHint enumerations. |
|
206 |
*/ |
|
207 |
class CxeCodecMapping |
|
208 |
{ |
|
209 |
public: |
|
210 |
CxeCodecMapping(const char *regexp, MCameraUseCaseHint::TVideoCodec codec, |
|
211 |
MCameraUseCaseHint::TVideoProfile profile) : |
|
212 |
mRegExp(regexp), |
|
213 |
mCodec(codec), |
|
214 |
mProfile(profile) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
{ |
45 | 216 |
// No implementation needed |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
} |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
|
45 | 219 |
public: |
220 |
QString mRegExp; |
|
221 |
MCameraUseCaseHint::TVideoCodec mCodec; |
|
222 |
MCameraUseCaseHint::TVideoProfile mProfile; |
|
223 |
}; |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
|
45 | 225 |
/*! |
226 |
Map video codec MIME type from ICM to enumerations used by the |
|
227 |
MCameraUseCaseHint custom interface |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
|
45 | 229 |
\param[in] videoDetails CxeVideoDetails defining the current video quality. |
230 |
\param[out] codec Reference where to store the video codec info. |
|
231 |
MCameraUseCaseHint::ECodecUnknown if not known. |
|
232 |
\param[out] profile Reference where to store the video profile info. |
|
233 |
MCameraUseCaseHint::EProfileUnknown if not known. |
|
234 |
*/ |
|
235 |
void CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters( |
|
236 |
const CxeVideoDetails &videoDetails, |
|
237 |
MCameraUseCaseHint::TVideoCodec &codec, |
|
238 |
MCameraUseCaseHint::TVideoProfile &profile) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
{ |
45 | 240 |
typedef QPair<MCameraUseCaseHint::TVideoCodec, |
241 |
MCameraUseCaseHint::TVideoProfile> CxeCodecAndProfile; |
|
242 |
||
243 |
codec = MCameraUseCaseHint::ECodecUnknown; |
|
244 |
profile = MCameraUseCaseHint::EProfileUnknown; |
|
245 |
||
246 |
// Create a mapping table for mapping from the MIME type string |
|
247 |
// to MCameraUseCaseHint codec and profile enums using QRegExp. Specific |
|
248 |
// rules should be before more generic ones because the map is iterated in |
|
249 |
// order. |
|
250 |
QList<CxeCodecMapping> mappingTable; |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
|
45 | 252 |
mappingTable << CxeCodecMapping("^video/H263-2000", |
253 |
MCameraUseCaseHint::ECodecH263, |
|
254 |
MCameraUseCaseHint::EProfileH263P0L10) |
|
255 |
||
256 |
<< CxeCodecMapping("^video/H264.*profile-level-id=42801E", |
|
257 |
MCameraUseCaseHint::ECodecH264, |
|
258 |
MCameraUseCaseHint::EProfileH264BpL3) |
|
259 |
||
260 |
<< CxeCodecMapping("^video/H264.*profile-level-id=42801F", |
|
261 |
MCameraUseCaseHint::ECodecH264, |
|
262 |
MCameraUseCaseHint::EProfileH264BpL3_1) |
|
263 |
||
264 |
<< CxeCodecMapping("^video/H264", // Other H.264 profile |
|
265 |
MCameraUseCaseHint::ECodecH264, |
|
266 |
MCameraUseCaseHint::EProfileUnknown) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
|
45 | 268 |
<< CxeCodecMapping("^video/mp4v-es.*profile-level-id=2", |
269 |
MCameraUseCaseHint::ECodecMpeg4, |
|
270 |
MCameraUseCaseHint::EProfileMPEG4SpL2) |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
|
45 | 272 |
<< CxeCodecMapping("^video/mp4v-es.*profile-level-id=3", |
273 |
MCameraUseCaseHint::ECodecMpeg4, |
|
274 |
MCameraUseCaseHint::EProfileMPEG4SpL3) |
|
275 |
||
276 |
<< CxeCodecMapping("^video/mp4v-es.*profile-level-id=4", |
|
277 |
MCameraUseCaseHint::ECodecMpeg4, |
|
278 |
MCameraUseCaseHint::EProfileMPEG4SpL4a) |
|
279 |
||
280 |
<< CxeCodecMapping("^video/mp4v-es", // Other MPEG-4 profile |
|
281 |
MCameraUseCaseHint::ECodecMpeg4, |
|
282 |
MCameraUseCaseHint::EProfileUnknown); |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
|
45 | 284 |
bool found = false; |
285 |
for (int i = 0; i < mappingTable.count() && !found; i++) { |
|
286 |
QRegExp regExp(mappingTable[i].mRegExp, Qt::CaseInsensitive); |
|
287 |
if (regExp.indexIn(videoDetails.mVideoCodecMimeType) >= 0) { |
|
288 |
found = true; |
|
289 |
codec = mappingTable[i].mCodec; |
|
290 |
profile = mappingTable[i].mProfile; |
|
291 |
||
292 |
CX_DEBUG(("Matched codec %d, profile 0x%x for '%s'", codec, profile, |
|
293 |
videoDetails.mVideoCodecMimeType.toAscii().constData())); |
|
294 |
} |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
} |
45 | 296 |
|
297 |
if (!found) { |
|
298 |
CX_DEBUG(("No codec/profile found for '%s'", |
|
299 |
videoDetails.mVideoCodecMimeType.toAscii().constData())); |
|
300 |
} |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
} |
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
|
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
// end of file |