1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __VEDQUALITYSETTINGSAPI_H__ |
|
21 #define __VEDQUALITYSETTINGSAPI_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "imagingconfigmanager.h" |
|
25 |
|
26 |
|
27 |
|
28 const TUint KQSMaxShortStringLength = 16; |
|
29 const TUint KQSMaxLongStringLength = 256; |
|
30 |
|
31 |
|
32 |
|
33 /* |
|
34 * Video quality set structure |
|
35 */ |
|
36 struct SVideoQualitySet |
|
37 { |
|
38 public: |
|
39 // Video aspect ratio: normal means one of the standard resolutions like QCIF, QVGA, CIF, VGA, if something else, like 16:9 |
|
40 TBool iVideoAspectRatioNormal; |
|
41 // Video file format mime type, e.g. "video/3gpp" |
|
42 TText8 iVideoFileMimeType[KQSMaxShortStringLength]; |
|
43 // Video codec mime type, e.g. "video/mp4v-es" |
|
44 TText8 iVideoCodecMimeType[KQSMaxLongStringLength]; |
|
45 // Video picture width in pixels (luminance) |
|
46 TInt iVideoWidth; |
|
47 // Video picture height in pixels (luminance) |
|
48 TInt iVideoHeight; |
|
49 // Video framerate in fps |
|
50 TReal iVideoFrameRate; |
|
51 // Video bitrate in bps |
|
52 TInt iVideoBitRate; |
|
53 // Random access point rate, in pictures per second. For example, to request a random access point every ten seconds, set the value to 0.1 |
|
54 TReal iRandomAccessRate; |
|
55 // Audio codec FourCC, e.g. " AMR" |
|
56 TText8 iAudioFourCCType[KQSMaxShortStringLength]; |
|
57 // Audio bitrate in bps |
|
58 TInt iAudioBitRate; |
|
59 // Audio sampling rate in Hz |
|
60 TInt iAudioSamplingRate; |
|
61 // Number of audio channels; in practice mono(1) vs stereo(2) |
|
62 TInt iAudioChannels; |
|
63 }; |
|
64 |
|
65 |
|
66 /* |
|
67 * API class for getting a quality set for a given level or given resolution |
|
68 */ |
|
69 class CVideoQualitySelector : public CBase |
|
70 { |
|
71 public: |
|
72 /* |
|
73 * Enumeration for nominal video quality levels. Client must use these enumerations to get quality sets. |
|
74 * However, if NumberOfQualityLevels() below indicates there are more than ENumberOfNominalLevels, client |
|
75 * can use values in-between the nominal values to get set for some other quality level. |
|
76 * It is however up to the implementation of the API to map such intermediate values to actual levels |
|
77 */ |
|
78 enum TVideoQualityLevels |
|
79 { |
|
80 // client can try asking values in between these but the class may round the values depending on the availability |
|
81 EVideoQualityMin = 0, // if there are several MMS compatible settings, EVideoQualityMMS is not the lowest. However level cannot go below this value |
|
82 EVideoQualityMMS = 10, // use this when MMS compatible settings are needed |
|
83 EVideoQualityNormal = 20, // use this when normal quality settings are needed, i.e. typically higher quality than MMS, but possibly not the highest still |
|
84 EVideoQualityHigh = 30, // use this when highest possible quality settings are needed |
|
85 EVideoQualityNominalGranularity = 10, |
|
86 ENumberOfNominalLevels = 3 |
|
87 }; |
|
88 |
|
89 public: |
|
90 /* |
|
91 * Create new CVideoQualitySelector object |
|
92 */ |
|
93 static CVideoQualitySelector* NewL(); |
|
94 |
|
95 static CVideoQualitySelector* NewLC(); |
|
96 |
|
97 /* |
|
98 * Destructor |
|
99 */ |
|
100 ~CVideoQualitySelector(); |
|
101 |
|
102 /* |
|
103 * Get number of defined quality levels. This is always at least ENumberOfNominalLevels but can be higher |
|
104 */ |
|
105 TInt NumberOfQualityLevels(); |
|
106 /* |
|
107 * Get quality set associated with the given level. The level should be between EVideoQualityHigh and EVideoQualityMin. |
|
108 * One the defined nominal levels should be used especially if NumberOfQualityLevels() == ENumberOfNominalLevels. |
|
109 * If there is no set associated with given intermediate level, then set from a nearest level is returned. |
|
110 */ |
|
111 void GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel ); |
|
112 /* |
|
113 * Get quality set associated with the given level. Otherwise the same as above but if aAspectRatioWide == ETrue, |
|
114 * tries to find 16:9 aspect ratio settings, otherwise returns a set from the normal aspect ratio as above. |
|
115 */ |
|
116 void GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel, TBool aAspectRatioWide ); |
|
117 /* |
|
118 * Get quality set associated with the given video resolution. Leaves if there is no defined set for the resolution. |
|
119 * E.g. if product configuration prefers QVGA over CIF, but client asks for CIF, this function leaves. The CIF settings |
|
120 * can then be requested using the MIME-type |
|
121 */ |
|
122 void GetVideoQualitySetL( SVideoQualitySet& aSet, const TSize& aVideoResolution ); |
|
123 /* |
|
124 * Get quality set associated with the given video codec MIME-type. Leaves if there is no defined set for the MIME-type. |
|
125 */ |
|
126 void GetVideoQualitySetL( SVideoQualitySet& aSet, const TPtrC8& aVideoCodecMimeType ); |
|
127 |
|
128 private: |
|
129 /* |
|
130 * Default constructor |
|
131 */ |
|
132 CVideoQualitySelector(); |
|
133 |
|
134 /* |
|
135 * Actual constructor |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 /* |
|
140 * Copies the values from the source set to the target set |
|
141 */ |
|
142 void MapQualitySet( SVideoQualitySet& aTargetSet, TVideoQualitySet& aSourceSet ); |
|
143 |
|
144 private: // Data |
|
145 |
|
146 CImagingConfigManager* iConfigManager; |
|
147 |
|
148 CArrayFixFlat<TUint>* iQualityLevels; |
|
149 |
|
150 }; |
|
151 |
|
152 #endif |
|