|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * |
|
14 * Description: Still Image Encoder for Camera Application Engine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CAESTILLENCODER_H |
|
21 #define CAESTILLENCODER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <s32file.h> |
|
26 #include <imageconversion.h> |
|
27 #include "CaeStillConverter.h" |
|
28 |
|
29 // CONSTANTS |
|
30 const TInt KJpegQualityMin = 0; |
|
31 const TInt KJpegQualityMax = 100; |
|
32 |
|
33 const TJpegImageData::TColorSampling KCaeJpegColorSampling = TJpegImageData::EColor420; |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Still encoder observer class. |
|
40 * User of CCaeStillEncoder class must derive from this interface. |
|
41 * |
|
42 * @lib CAESTILLCONVERTER.LIB |
|
43 * @since 2.1 |
|
44 */ |
|
45 class MCaeStillEncoderObserver |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Called back by CCaeStillEncoder when it completes conversion (encoding) to HBufC8 image data (as JPEG). |
|
50 * single media item during media items enumeration. |
|
51 * @since 2.1 |
|
52 * @param aBitmap Source Symbian OS bitmap image |
|
53 * @param aImageData Converted image (as JPEG) |
|
54 * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code |
|
55 * @param aImageSize Encoded image size |
|
56 * @return void |
|
57 */ |
|
58 virtual void McaeseoHBufC8ImageReady( |
|
59 CFbsBitmap* aBitmap, |
|
60 HBufC8* aImageData, |
|
61 TInt aError, |
|
62 TInt aImageSize ) = 0; |
|
63 }; |
|
64 |
|
65 |
|
66 // CLASS DECLARATION |
|
67 |
|
68 /** |
|
69 * Still Encoder class. Derived from CaeStillConverter. |
|
70 * Implements still image encoding for Camera Application Engine |
|
71 * using Symbian Image Conversion Library (ICL). |
|
72 * |
|
73 * @lib CAESTILLCONVERTER.LIB |
|
74 * @since 2.1 |
|
75 */ |
|
76 NONSHARABLE_CLASS( CCaeStillEncoder ) : public CCaeStillConverter |
|
77 { |
|
78 public: // Conversion target image type. |
|
79 |
|
80 enum TTargetFormat |
|
81 { |
|
82 ETargetFormatJPEG |
|
83 }; |
|
84 |
|
85 public: // Constructor and destructor |
|
86 /** |
|
87 * Two-phased constructor. |
|
88 */ |
|
89 IMPORT_C static CCaeStillEncoder* NewL(); |
|
90 |
|
91 /** |
|
92 * Destructor. |
|
93 */ |
|
94 IMPORT_C virtual ~CCaeStillEncoder(); |
|
95 |
|
96 public: // From CCaeStillConverter: |
|
97 |
|
98 void SetImageCodecL( |
|
99 TUid aCodecUid ); |
|
100 |
|
101 public: // New functions |
|
102 /** |
|
103 * Sets Still Encoder observer. |
|
104 * @since 2.1 |
|
105 * @param aObserver Still Encoder observer |
|
106 * @return void |
|
107 */ |
|
108 IMPORT_C void SetObserver( |
|
109 MCaeStillEncoderObserver* aObserver ); |
|
110 |
|
111 /** |
|
112 * Sets compression quality. |
|
113 * @since 2.1 |
|
114 * @param aQuality Compression quality |
|
115 * @return void |
|
116 */ |
|
117 IMPORT_C void SetCompressionQuality( |
|
118 TInt aQuality ); |
|
119 |
|
120 /** |
|
121 * Gets compression quality. |
|
122 * @since 2.1 |
|
123 * @return Compression quality |
|
124 */ |
|
125 IMPORT_C TInt CompressionQuality() const; |
|
126 |
|
127 /** |
|
128 * Creates the CImageItem object, places it in the internal queue and |
|
129 * starts the memory image conversion where the memory bitmap is |
|
130 * converted to another format (e.g. JPEG). |
|
131 * @since 2.1 |
|
132 * @param aBitmap Bitmap to convert |
|
133 * @param aTargetFormat Target/destination image format (JPEG by default) |
|
134 * @return void |
|
135 */ |
|
136 IMPORT_C void ConvertCFbsBitmapToHBufC8L( |
|
137 CFbsBitmap* aBitmap, |
|
138 TTargetFormat aTargetFormat = ETargetFormatJPEG ); |
|
139 |
|
140 /** |
|
141 * Destroys all allocations for encoding, as the images from the queue. |
|
142 * @return void |
|
143 */ |
|
144 IMPORT_C void Cleanup(); |
|
145 |
|
146 private: // Constructors |
|
147 /** |
|
148 * C++ constructor. |
|
149 */ |
|
150 CCaeStillEncoder(); |
|
151 |
|
152 /** |
|
153 * Symbian 2nd phase constructor that can leave. |
|
154 */ |
|
155 void ConstructL(); |
|
156 |
|
157 private: // From CCaeStillConverter: |
|
158 |
|
159 /** |
|
160 * From CActive, implements cancellation of an outstanding request. |
|
161 * @return void |
|
162 */ |
|
163 void DoCancel(); |
|
164 |
|
165 private: // From CCaeStillConverter: |
|
166 |
|
167 void ConvertL(); |
|
168 |
|
169 void ConversionComplete( |
|
170 TInt aError ); |
|
171 |
|
172 private: // Data |
|
173 |
|
174 // Still Encoder observer. |
|
175 MCaeStillEncoderObserver* iObserver; |
|
176 |
|
177 // Pointer to ICL encoder object. |
|
178 CImageEncoder* iEncoder; |
|
179 |
|
180 // Pointer to encoded image. |
|
181 HBufC8* iEncodedImage; |
|
182 |
|
183 // Quality factor for JPEG images. |
|
184 TInt iJpegQuality; |
|
185 }; |
|
186 |
|
187 |
|
188 #endif // CAESTILLENCODER_H |
|
189 |
|
190 |
|
191 // End of File |