|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Implementation of CVisualFrame, CExtJpegDecoder and CExtJpegEncoder |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
20 #include <icl_uids_def.hrh> |
|
21 #endif |
|
22 #include "IclExtJpegApi.h" |
|
23 #include "IclExtJpegApiFrameImpl.h" |
|
24 |
|
25 |
|
26 /*****************************************************/ |
|
27 /* Visual Frame Data Structure in Extended ICL API */ |
|
28 /*****************************************************/ |
|
29 |
|
30 // --------------------------------------------------------- |
|
31 // CVisualFrame* CVisualFrame::NewL |
|
32 // Two-phased constructor. |
|
33 // --------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CVisualFrame* CVisualFrame::NewL( |
|
36 TDes8& aBuffer, |
|
37 const TSize& aDimension, |
|
38 TInt aFrameFormat ) |
|
39 { |
|
40 |
|
41 CVisualFrame* self = new ( ELeave ) CVisualFrame(); |
|
42 CleanupStack::PushL( self ); |
|
43 self->iVisualFrameImpl = CVisualFrameImpl::NewL( aBuffer, aDimension, aFrameFormat ); |
|
44 CleanupStack::Pop( self ); |
|
45 |
|
46 return self; |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------- |
|
50 // CVisualFrame* CVisualFrame::NewL |
|
51 // Two-phased constructor. |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C CVisualFrame* CVisualFrame::NewL( |
|
55 RChunk& aChunk, |
|
56 TInt aSize, |
|
57 TInt aMaxSize, |
|
58 TInt aDataOffset, |
|
59 const TSize& aDimension, |
|
60 TInt aFrameFormat ) |
|
61 { |
|
62 CVisualFrame* self = new ( ELeave ) CVisualFrame(); |
|
63 CleanupStack::PushL( self ); |
|
64 self->iVisualFrameImpl = CVisualFrameImpl::NewL( aChunk, aSize, aMaxSize, |
|
65 aDataOffset, aDimension, aFrameFormat ); |
|
66 CleanupStack::Pop( self ); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CVisualFrame* CVisualFrame::NewL |
|
73 // Two-phased constructor. |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 EXPORT_C CVisualFrame* CVisualFrame::NewL( |
|
77 TDes8& aBuffer, |
|
78 const TSize& aDimension, |
|
79 TInt aFrameFormat, |
|
80 const TFrameLayout& aFrameLayout ) |
|
81 { |
|
82 CVisualFrame* self = new ( ELeave ) CVisualFrame(); |
|
83 CleanupStack::PushL( self ); |
|
84 self->iVisualFrameImpl = CVisualFrameImpl::NewL( aBuffer, aDimension, |
|
85 aFrameFormat, aFrameLayout ); |
|
86 CleanupStack::Pop( self ); |
|
87 |
|
88 return self; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------- |
|
92 // CVisualFrame* CVisualFrame::NewL |
|
93 // Two-phased constructor. |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 EXPORT_C CVisualFrame* CVisualFrame::NewL( |
|
97 RChunk& aChunk, |
|
98 TInt aSize, |
|
99 TInt aMaxSize, |
|
100 const TSize& aDimension, |
|
101 TInt aFrameFormat, |
|
102 const TFrameLayout& aFrameLayout ) |
|
103 { |
|
104 CVisualFrame* self = new ( ELeave ) CVisualFrame(); |
|
105 CleanupStack::PushL( self ); |
|
106 self->iVisualFrameImpl = CVisualFrameImpl::NewL( aChunk, aSize, aMaxSize, |
|
107 aDimension, aFrameFormat, |
|
108 aFrameLayout ); |
|
109 CleanupStack::Pop( self ); |
|
110 |
|
111 return self; |
|
112 } |
|
113 |
|
114 // ---------------------------------------------------------- |
|
115 // CVisualFrame::DataChunkL |
|
116 // ---------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C const RChunk& CVisualFrame::DataChunkL() const |
|
119 { |
|
120 return iVisualFrameImpl->DataChunkL(); |
|
121 } |
|
122 |
|
123 // ---------------------------------------------------------- |
|
124 // CVisualFrame::DataPtrL |
|
125 // ---------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C TPtr8 CVisualFrame::DataPtrL() const |
|
128 { |
|
129 return iVisualFrameImpl->DataPtrL(); |
|
130 } |
|
131 |
|
132 // ---------------------------------------------------------- |
|
133 // CVisualFrame::Dimension |
|
134 // ---------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C TSize CVisualFrame::Dimension() const |
|
137 { |
|
138 return iVisualFrameImpl->Dimension(); |
|
139 } |
|
140 |
|
141 // ---------------------------------------------------------- |
|
142 // CVisualFrame::FrameFormat |
|
143 // ---------------------------------------------------------- |
|
144 // |
|
145 EXPORT_C TInt CVisualFrame::FrameFormat() const |
|
146 { |
|
147 return iVisualFrameImpl->FrameFormat2(); |
|
148 } |
|
149 |
|
150 // ---------------------------------------------------------- |
|
151 // CVisualFrame::DataOffset |
|
152 // ---------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C TInt CVisualFrame::DataOffset() const |
|
155 { |
|
156 return iVisualFrameImpl->DataOffset(); |
|
157 } |
|
158 |
|
159 // ---------------------------------------------------------- |
|
160 // CVisualFrame::Size |
|
161 // ---------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C TInt CVisualFrame::Size() const |
|
164 { |
|
165 return iVisualFrameImpl->Size(); |
|
166 } |
|
167 |
|
168 // ---------------------------------------------------------- |
|
169 // CVisualFrame::SetSizeL |
|
170 // ---------------------------------------------------------- |
|
171 // |
|
172 EXPORT_C void CVisualFrame::SetSizeL( TInt aSize ) |
|
173 { |
|
174 iVisualFrameImpl->SetSizeL( aSize ); |
|
175 } |
|
176 |
|
177 // ---------------------------------------------------------- |
|
178 // CVisualFrame::MaxSize |
|
179 // ---------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C TInt CVisualFrame::MaxSize() const |
|
182 { |
|
183 return iVisualFrameImpl->MaxSize(); |
|
184 } |
|
185 |
|
186 // ---------------------------------------------------------- |
|
187 // CVisualFrame::DataContainer |
|
188 // ---------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C CVisualFrame::TDataContainer CVisualFrame::DataContainer() const |
|
191 { |
|
192 return ( TDataContainer )iVisualFrameImpl->DataContainer(); |
|
193 } |
|
194 |
|
195 // ---------------------------------------------------------- |
|
196 // CVisualFrame::FrameLayout |
|
197 // ---------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C const CVisualFrame::TFrameLayout& CVisualFrame::FrameLayout() const |
|
200 { |
|
201 return iVisualFrameImpl->FrameLayout2(); |
|
202 } |
|
203 |
|
204 // ---------------------------------------------------------- |
|
205 // CVisualFrame::~CVisualFrame |
|
206 // Destructor |
|
207 // ---------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C CVisualFrame::~CVisualFrame() |
|
210 { |
|
211 delete iVisualFrameImpl; |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------- |
|
215 // CVisualFrame* CVisualFrame::NewL |
|
216 // Two-phased constructor. |
|
217 // --------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C CVisualFrame* CVisualFrame::NewL( const CImageFrame* aImageFrame ) |
|
220 { |
|
221 CVisualFrame* self = new ( ELeave ) CVisualFrame(); |
|
222 CleanupStack::PushL( self ); |
|
223 self->iVisualFrameImpl = CVisualFrameImpl::NewL( aImageFrame ); |
|
224 CleanupStack::Pop( self ); |
|
225 |
|
226 return self; |
|
227 } |
|
228 |
|
229 // ---------------------------------------------------------- |
|
230 // CVisualFrame::GetImageFrameL |
|
231 // ---------------------------------------------------------- |
|
232 // |
|
233 EXPORT_C CImageFrame* CVisualFrame::GetImageFrameL() |
|
234 { |
|
235 return iVisualFrameImpl->GetImageFrameL(); |
|
236 } |
|
237 |
|
238 |
|
239 /*****************************************************/ |
|
240 /* Extended ICL Jpeg Decoder API */ |
|
241 /*****************************************************/ |
|
242 |
|
243 // --------------------------------------------------------- |
|
244 // CExtJpegDecoder* CExtJpegDecoder::NewL |
|
245 // Two-phased constructor. |
|
246 // --------------------------------------------------------- |
|
247 // |
|
248 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::NewL() |
|
249 { |
|
250 return new (ELeave) CExtJpegDecoder(); |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------- |
|
254 // CExtJpegDecoder* CExtJpegDecoder::FileNewL |
|
255 // Creates, initializes and returns a pointer to an object of |
|
256 // class CExtJpegDecoder |
|
257 // --------------------------------------------------------- |
|
258 // |
|
259 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::FileNewL( |
|
260 RFs& aFs, const TDesC& aSourceFilename, |
|
261 const TDesC8& aMIMEType, |
|
262 const TOptions aOptions ) |
|
263 { |
|
264 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
265 CImageDecoder::FileNewL( aFs, aSourceFilename, |
|
266 aMIMEType, aOptions ) ); |
|
267 CleanupStack::PushL( dec ); |
|
268 if ( dec->CapabilitiesL() < ECapNone ) |
|
269 { |
|
270 User::Leave( KErrNotFound ); |
|
271 } |
|
272 CleanupStack::Pop(); |
|
273 return dec; |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------- |
|
277 // CExtJpegDecoder* CExtJpegDecoder::FileNewL |
|
278 // Creates, initializes and returns a pointer to an object of |
|
279 // class CExtJpegDecoder |
|
280 // --------------------------------------------------------- |
|
281 // |
|
282 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::FileNewL( |
|
283 RFs& aFs, |
|
284 const TDesC& aSourceFilename, |
|
285 const TOptions aOptions, |
|
286 const TUid aImageType, |
|
287 const TUid aImageSubType, |
|
288 const TUid aDecoderUid ) |
|
289 { |
|
290 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
291 CImageDecoder::FileNewL( aFs, aSourceFilename, aOptions, |
|
292 aImageType, aImageSubType, aDecoderUid ) ); |
|
293 CleanupStack::PushL( dec ); |
|
294 if ( dec->CapabilitiesL() < ECapNone ) |
|
295 { |
|
296 User::Leave( KErrNotFound ); |
|
297 } |
|
298 CleanupStack::Pop(); |
|
299 return dec; |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------- |
|
303 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
304 // Creates, initializes and returns a pointer to an object of |
|
305 // class CExtJpegDecoder |
|
306 // --------------------------------------------------------- |
|
307 // |
|
308 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
309 RFs& aFs, |
|
310 const TDesC8& aSourceData, |
|
311 const TDesC8& aMIMEType, |
|
312 const TOptions aOptions ) |
|
313 { |
|
314 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
315 CImageDecoder::DataNewL( aFs, aSourceData, |
|
316 aMIMEType, aOptions ) ); |
|
317 CleanupStack::PushL( dec ); |
|
318 if ( dec->CapabilitiesL() < ECapNone ) |
|
319 { |
|
320 User::Leave( KErrNotFound ); |
|
321 } |
|
322 CleanupStack::Pop(); |
|
323 return dec; |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------- |
|
327 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
328 // Creates, initializes and returns a pointer to an object of |
|
329 // class CExtJpegDecoder |
|
330 // --------------------------------------------------------- |
|
331 // |
|
332 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
333 RFs& aFs, |
|
334 const TDesC8& aSourceData, |
|
335 const TOptions aOptions, |
|
336 const TUid aImageType, |
|
337 const TUid aImageSubType, |
|
338 const TUid aDecoderUid ) |
|
339 { |
|
340 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
341 CImageDecoder::DataNewL( aFs, aSourceData, aOptions, |
|
342 aImageType, aImageSubType, aDecoderUid ) ); |
|
343 CleanupStack::PushL( dec ); |
|
344 if ( dec->CapabilitiesL() < ECapNone ) |
|
345 { |
|
346 User::Leave( KErrNotFound ); |
|
347 } |
|
348 CleanupStack::Pop(); |
|
349 return dec; |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------- |
|
353 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
354 // Creates, initializes and returns a pointer to an object of |
|
355 // class CExtJpegDecoder |
|
356 // --------------------------------------------------------- |
|
357 // |
|
358 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
359 RFs& aFs, |
|
360 const CVisualFrame* aSourceData, |
|
361 const TDesC8& aMIMEType, |
|
362 const TOptions aOptions ) |
|
363 { |
|
364 |
|
365 TUint8* sourcePtr = NULL; |
|
366 CVisualFrame* sourceDataFrame = const_cast<CVisualFrame*>( aSourceData ); |
|
367 if ( sourceDataFrame->DataContainer() == CVisualFrame::EInChunk ) |
|
368 { |
|
369 sourcePtr = sourceDataFrame->DataChunkL().Base() + sourceDataFrame->DataOffset(); |
|
370 } |
|
371 else if ( sourceDataFrame->DataContainer() == CVisualFrame::EInDescriptor ) |
|
372 { |
|
373 sourcePtr = const_cast<TUint8*>( sourceDataFrame->DataPtrL().Ptr() ) |
|
374 + sourceDataFrame->DataOffset(); |
|
375 } |
|
376 else |
|
377 { |
|
378 User::Leave( KErrArgument ); |
|
379 } |
|
380 TPtrC8 sourceData( sourcePtr, sourceDataFrame->Size() ); |
|
381 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
382 CImageDecoder::DataNewL( aFs, sourceData, |
|
383 aMIMEType, aOptions ) ); |
|
384 CleanupStack::PushL( dec ); |
|
385 if ( dec->CapabilitiesL() < ECapNone ) |
|
386 { |
|
387 User::Leave( KErrNotFound ); |
|
388 } |
|
389 CleanupStack::Pop(); |
|
390 return dec; |
|
391 } |
|
392 |
|
393 // --------------------------------------------------------- |
|
394 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
395 // Creates, initializes and returns a pointer to an object of |
|
396 // class CExtJpegDecoder |
|
397 // --------------------------------------------------------- |
|
398 // |
|
399 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
400 RFs& aFs, |
|
401 const CVisualFrame* aSourceData, |
|
402 const TOptions aOptions, |
|
403 const TUid aImageType, |
|
404 const TUid aImageSubType, |
|
405 const TUid aDecoderUid ) |
|
406 { |
|
407 TUint8* sourcePtr = NULL; |
|
408 CVisualFrame* sourceDataFrame = const_cast<CVisualFrame*>( aSourceData ); |
|
409 if ( sourceDataFrame->DataContainer() == CVisualFrame::EInChunk ) |
|
410 { |
|
411 sourcePtr = sourceDataFrame->DataChunkL().Base() + sourceDataFrame->DataOffset(); |
|
412 } |
|
413 else if ( aSourceData->DataContainer() == CVisualFrame::EInDescriptor ) |
|
414 { |
|
415 sourcePtr = const_cast<TUint8*>( sourceDataFrame->DataPtrL().Ptr() ) |
|
416 + sourceDataFrame->DataOffset(); |
|
417 } |
|
418 else |
|
419 { |
|
420 User::Leave( KErrArgument ); |
|
421 } |
|
422 |
|
423 TPtrC8 sourceData( sourcePtr, sourceDataFrame->Size() ); |
|
424 CExtJpegDecoder* dec = reinterpret_cast<CExtJpegDecoder*>( |
|
425 CImageDecoder::DataNewL( aFs, sourceData, aOptions, |
|
426 aImageType, aImageSubType, aDecoderUid ) ); |
|
427 CleanupStack::PushL( dec ); |
|
428 if ( dec->CapabilitiesL() < ECapNone ) |
|
429 { |
|
430 User::Leave( KErrNotFound ); |
|
431 } |
|
432 CleanupStack::Pop(); |
|
433 return dec; |
|
434 } |
|
435 |
|
436 // ---------------------------------------------------------- |
|
437 // CExtJpegDecoder::~CExtJpegDecoder |
|
438 // Destructor |
|
439 // ---------------------------------------------------------- |
|
440 // |
|
441 EXPORT_C CExtJpegDecoder::~CExtJpegDecoder() |
|
442 { |
|
443 } |
|
444 |
|
445 // ---------------------------------------------------------- |
|
446 // CExtJpegDecoder::SetCroppingL |
|
447 // ---------------------------------------------------------- |
|
448 // |
|
449 EXPORT_C void CExtJpegDecoder::SetCroppingL( TRect aCropRect ) |
|
450 { |
|
451 CustomSyncL( KExtensionUID ); |
|
452 CustomSyncL( ECapCropping ); |
|
453 CustomSyncL( reinterpret_cast<TInt>( &aCropRect ) ); |
|
454 CustomSyncL( EEnd ); |
|
455 } |
|
456 |
|
457 // ---------------------------------------------------------- |
|
458 // CExtJpegDecoder::SetStreamingL |
|
459 // ---------------------------------------------------------- |
|
460 // |
|
461 EXPORT_C void CExtJpegDecoder::SetStreamingL( TSize& aMacroBlockSize ) |
|
462 { |
|
463 CustomSyncL( KExtensionUID ); |
|
464 CustomSyncL( ECapStreaming ); |
|
465 CustomSyncL( reinterpret_cast<TInt>( &aMacroBlockSize ) ); |
|
466 CustomSyncL( EEnd ); |
|
467 } |
|
468 |
|
469 // ---------------------------------------------------------- |
|
470 // CExtJpegDecoder::SetRotationL |
|
471 // ---------------------------------------------------------- |
|
472 // |
|
473 EXPORT_C void CExtJpegDecoder::SetRotationL( TInt aDegree ) |
|
474 { |
|
475 CustomSyncL( KExtensionUID ); |
|
476 CustomSyncL( ECapRotation ); |
|
477 CustomSyncL( aDegree ); |
|
478 CustomSyncL( EEnd ); |
|
479 } |
|
480 |
|
481 // ---------------------------------------------------------- |
|
482 // CExtJpegDecoder::SetFlippingL |
|
483 // ---------------------------------------------------------- |
|
484 // |
|
485 EXPORT_C void CExtJpegDecoder::SetFlippingL() |
|
486 { |
|
487 CustomSyncL( KExtensionUID ); |
|
488 CustomSyncL( ECapFlipping ); |
|
489 CustomSyncL( EEnd ); |
|
490 } |
|
491 |
|
492 // ---------------------------------------------------------- |
|
493 // CExtJpegDecoder::SetMirroringL |
|
494 // ---------------------------------------------------------- |
|
495 // |
|
496 EXPORT_C void CExtJpegDecoder::SetMirroringL() |
|
497 { |
|
498 CustomSyncL( KExtensionUID ); |
|
499 CustomSyncL( ECapMirroring ); |
|
500 CustomSyncL( EEnd ); |
|
501 } |
|
502 |
|
503 // ---------------------------------------------------------- |
|
504 // CExtJpegDecoder::SetDctDecodingL |
|
505 // ---------------------------------------------------------- |
|
506 // |
|
507 EXPORT_C void CExtJpegDecoder::SetDctDecodingL() |
|
508 { |
|
509 CustomSyncL( KExtensionUID ); |
|
510 CustomSyncL( ECapDctDecoding ); |
|
511 CustomSyncL( EEnd ); |
|
512 } |
|
513 |
|
514 // ---------------------------------------------------------- |
|
515 // CExtJpegDecoder::ConvertL |
|
516 // ---------------------------------------------------------- |
|
517 // |
|
518 EXPORT_C void CExtJpegDecoder::ConvertL( |
|
519 TRequestStatus* aRequestStatus, |
|
520 const CVisualFrame* aDestinationFrame, |
|
521 TInt& aNoOfDecodedMBlocks, |
|
522 TInt aFrameNumber ) |
|
523 { |
|
524 iIsExtConvert = ETrue; |
|
525 CustomSyncL( KExtensionUID ); |
|
526 CustomSyncL( EConvert ); |
|
527 CustomSyncL( reinterpret_cast<TInt>( aDestinationFrame ) ); |
|
528 CustomSyncL( reinterpret_cast<TInt>( &aNoOfDecodedMBlocks ) ); |
|
529 CustomSyncL( aFrameNumber ); |
|
530 CustomSyncL( EReadyForAsync ); |
|
531 CustomAsync( aRequestStatus, 0 ); |
|
532 } |
|
533 |
|
534 // ---------------------------------------------------------- |
|
535 // CExtJpegDecoder::ContinueConvertL |
|
536 // ---------------------------------------------------------- |
|
537 // |
|
538 EXPORT_C void CExtJpegDecoder::ContinueConvertL( |
|
539 TRequestStatus* aRequestStatus, |
|
540 const CVisualFrame* aDestinationFrame, |
|
541 TInt& aNoOfDecodedMBlocks, |
|
542 TInt aFrameNumber ) |
|
543 { |
|
544 iIsExtConvert = ETrue; |
|
545 CustomSyncL( KExtensionUID ); |
|
546 CustomSyncL( EContinueConvert ); |
|
547 CustomSyncL( reinterpret_cast<TInt>( aDestinationFrame ) ); |
|
548 CustomSyncL( reinterpret_cast<TInt>( &aNoOfDecodedMBlocks ) ); |
|
549 CustomSyncL( aFrameNumber ); |
|
550 CustomSyncL( EReadyForAsync ); |
|
551 CustomAsync( aRequestStatus, 0 ); |
|
552 } |
|
553 |
|
554 // ---------------------------------------------------------- |
|
555 // CExtJpegDecoder::SupportedFormatsL |
|
556 // ---------------------------------------------------------- |
|
557 // |
|
558 EXPORT_C TInt CExtJpegDecoder::SupportedFormatsL() |
|
559 { |
|
560 CustomSyncL( KExtensionUID ); |
|
561 CustomSyncL( ESupportedFormats ); |
|
562 TInt retVal = KErrNotFound; |
|
563 CustomSyncL( reinterpret_cast<TInt>( &retVal ) ); |
|
564 CustomSyncL( EEnd ); |
|
565 return retVal; |
|
566 } |
|
567 |
|
568 // ---------------------------------------------------------- |
|
569 // CExtJpegDecoder::CapabilitiesL |
|
570 // ---------------------------------------------------------- |
|
571 // |
|
572 EXPORT_C TInt CExtJpegDecoder::CapabilitiesL() |
|
573 { |
|
574 CustomSyncL( KExtensionUID ); |
|
575 CustomSyncL( ECapabilities ); |
|
576 TInt retVal = KErrNotFound; |
|
577 CustomSyncL( reinterpret_cast<TInt>( &retVal ) ); |
|
578 CustomSyncL( EEnd ); |
|
579 return retVal; |
|
580 } |
|
581 |
|
582 // ---------------------------------------------------------- |
|
583 // CExtJpegDecoder::CExtJpegDecoder |
|
584 // ---------------------------------------------------------- |
|
585 // |
|
586 CExtJpegDecoder::CExtJpegDecoder() : CJPEGImageFrameDecoder() |
|
587 { |
|
588 } |
|
589 |
|
590 // ---------------------------------------------------------- |
|
591 // CExtJpegDecoder::Convert |
|
592 // ---------------------------------------------------------- |
|
593 // |
|
594 EXPORT_C void CExtJpegDecoder::Convert( TRequestStatus* aRequestStatus, |
|
595 CFbsBitmap& aDestination, TInt aFrameNumber ) |
|
596 { |
|
597 iIsExtConvert = EFalse; |
|
598 CImageDecoder::Convert( aRequestStatus, aDestination, aFrameNumber ); |
|
599 } |
|
600 |
|
601 // ---------------------------------------------------------- |
|
602 // CExtJpegDecoder::Convert |
|
603 // ---------------------------------------------------------- |
|
604 // |
|
605 EXPORT_C void CExtJpegDecoder::Convert( TRequestStatus* aRequestStatus, |
|
606 CFbsBitmap& aDestination, |
|
607 CFbsBitmap& aDestinationMask, TInt aFrameNumber ) |
|
608 { |
|
609 iIsExtConvert = EFalse; |
|
610 CImageDecoder::Convert( aRequestStatus, aDestination, aDestinationMask, aFrameNumber ); |
|
611 } |
|
612 |
|
613 // ---------------------------------------------------------- |
|
614 // CExtJpegDecoder::ContinueConvert |
|
615 // ---------------------------------------------------------- |
|
616 // |
|
617 EXPORT_C void CExtJpegDecoder::ContinueConvert( TRequestStatus* aRequestStatus ) |
|
618 { |
|
619 if( iIsExtConvert ) |
|
620 { |
|
621 User::RequestComplete( aRequestStatus, KErrUnknown ); |
|
622 } |
|
623 else |
|
624 { |
|
625 CImageDecoder::ContinueConvert( aRequestStatus ); |
|
626 } |
|
627 } |
|
628 |
|
629 // ---------------------------------------------------------- |
|
630 // CExtJpegDecoder* CExtJpegDecoder::FileNewL |
|
631 // Creates, initializes and returns a pointer to an object of |
|
632 // class CExtJpegDecoder |
|
633 // ---------------------------------------------------------- |
|
634 // |
|
635 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::FileNewL( |
|
636 const TDecoderType aDecoderType, |
|
637 RFs& aFs, |
|
638 const TDesC& aSourceFileName, |
|
639 const TOptions aOptions ) |
|
640 { |
|
641 TInt versionMin = KMinSwVersion; |
|
642 TInt versionMax = KMaxSwVersion; |
|
643 if ( aDecoderType == EHwImplementation ) |
|
644 { |
|
645 versionMin = KMinHwVersion; |
|
646 versionMax = KMaxHwVersion; |
|
647 } |
|
648 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
649 if ( uId == KNullUid ) |
|
650 { |
|
651 User::Leave( KErrNotFound ); |
|
652 } |
|
653 return CExtJpegDecoder::FileNewL( aFs, aSourceFileName, aOptions, |
|
654 KImageTypeJPGUid, KNullUid, uId ); |
|
655 } |
|
656 |
|
657 // ---------------------------------------------------------- |
|
658 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
659 // Creates, initializes and returns a pointer to an object of |
|
660 // class CExtJpegDecoder |
|
661 // ---------------------------------------------------------- |
|
662 // |
|
663 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
664 const TDecoderType aDecoderType, |
|
665 RFs& aFs, |
|
666 const TDesC8& aSourceData, |
|
667 const TOptions aOptions ) |
|
668 { |
|
669 TInt versionMin = KMinSwVersion; |
|
670 TInt versionMax = KMaxSwVersion; |
|
671 if ( aDecoderType == EHwImplementation ) |
|
672 { |
|
673 versionMin = KMinHwVersion; |
|
674 versionMax = KMaxHwVersion; |
|
675 } |
|
676 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
677 if ( uId == KNullUid ) |
|
678 { |
|
679 User::Leave( KErrNotFound ); |
|
680 } |
|
681 return CExtJpegDecoder::DataNewL( aFs, aSourceData, aOptions, |
|
682 KImageTypeJPGUid, KNullUid, uId ); |
|
683 |
|
684 } |
|
685 |
|
686 // ---------------------------------------------------------- |
|
687 // CExtJpegDecoder* CExtJpegDecoder::DataNewL |
|
688 // Creates, initializes and returns a pointer to an object of |
|
689 // class CExtJpegDecoder |
|
690 // ---------------------------------------------------------- |
|
691 // |
|
692 EXPORT_C CExtJpegDecoder* CExtJpegDecoder::DataNewL( |
|
693 const TDecoderType aDecoderType, |
|
694 RFs& aFs, |
|
695 const CVisualFrame* aSourceData, |
|
696 const TOptions aOptions ) |
|
697 { |
|
698 TInt versionMin = KMinSwVersion; |
|
699 TInt versionMax = KMaxSwVersion; |
|
700 if ( aDecoderType == EHwImplementation ) |
|
701 { |
|
702 versionMin = KMinHwVersion; |
|
703 versionMax = KMaxHwVersion; |
|
704 } |
|
705 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
706 if ( uId == KNullUid ) |
|
707 { |
|
708 User::Leave( KErrNotFound ); |
|
709 } |
|
710 return CExtJpegDecoder::DataNewL( aFs, aSourceData, aOptions, |
|
711 KImageTypeJPGUid, KNullUid, uId ); |
|
712 } |
|
713 |
|
714 |
|
715 // ---------------------------------------------------------- |
|
716 // CExtJpegDecoder::GetUidByVersionRangeL |
|
717 // ---------------------------------------------------------- |
|
718 // |
|
719 TUid CExtJpegDecoder::GetUidByVersionRangeL( TInt aMinVersion, TInt aMaxVersion ) |
|
720 { |
|
721 TUid uId = KNullUid; |
|
722 TUid propertyUid = KUidSwCodec; |
|
723 |
|
724 RUidDataArray implArray; |
|
725 // based on the version decide what kind of codec to fetch |
|
726 if( ( aMinVersion == KMinSwVersion ) && ( aMaxVersion == KMaxSwVersion ) ) |
|
727 { |
|
728 propertyUid = KUidSwCodec; |
|
729 } |
|
730 else if( ( aMinVersion == KMinHwVersion ) && ( aMaxVersion == KMaxHwVersion ) ) |
|
731 { |
|
732 propertyUid = KUidHwCodec; |
|
733 } |
|
734 |
|
735 // property array to be verified |
|
736 const TUid properties[] = { propertyUid, KImageTypeJPGUid }; |
|
737 |
|
738 // Request existing plugins with the desired properties |
|
739 TRAPD( getIntErr, CImageDecoder::GetInterfaceImplementationsL( |
|
740 properties, |
|
741 2, |
|
742 implArray ) ); |
|
743 CleanupClosePushL( implArray ); |
|
744 User::LeaveIfError( getIntErr ); |
|
745 |
|
746 TInt count = implArray.Count(); |
|
747 for( --count; uId == KNullUid && count >= 0; --count ) |
|
748 { |
|
749 // Get the Jpeg decoder UID and find out whether it is requested |
|
750 // type of decoder by version number. |
|
751 TUid tempUid = implArray[ count ]; |
|
752 CImplementationInformationType* implInfo = NULL; |
|
753 TRAPD( error, implInfo = |
|
754 CImageDecoder::GetImplementationInformationL( tempUid ) ); |
|
755 |
|
756 User::LeaveIfError( error ); |
|
757 |
|
758 // check the opaque data and version no |
|
759 TInt version = implInfo->Version(); |
|
760 if ( ( implInfo->OpaqueData().Find( KJpgMimeType ) != KErrNotFound ) |
|
761 && ( version <= aMaxVersion ) && ( version >= aMinVersion ) ) |
|
762 { |
|
763 uId = tempUid; |
|
764 } |
|
765 delete implInfo; |
|
766 } // for - count |
|
767 CleanupStack::PopAndDestroy(&implArray); |
|
768 return uId; |
|
769 |
|
770 } |
|
771 |
|
772 |
|
773 |
|
774 /*****************************************************/ |
|
775 /* Extended ICL Jpeg Encoder API */ |
|
776 /*****************************************************/ |
|
777 |
|
778 |
|
779 // --------------------------------------------------------- |
|
780 // CExtJpegEncoder* CExtJpegEncoder::NewL |
|
781 // Two-phased constructor. |
|
782 // --------------------------------------------------------- |
|
783 // |
|
784 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::NewL() |
|
785 { |
|
786 return new (ELeave) CExtJpegEncoder(); |
|
787 } |
|
788 |
|
789 // --------------------------------------------------------- |
|
790 // CExtJpegEncoder* CExtJpegEncoder::FileNewL |
|
791 // Creates, initializes and returns a pointer to an object of |
|
792 // class CExtJpegEncoder |
|
793 // --------------------------------------------------------- |
|
794 // |
|
795 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::FileNewL( |
|
796 RFs& aFs, |
|
797 const TDesC& aDestinationFilename, |
|
798 const TDesC8& aMIMEType, |
|
799 const TOptions aOptions ) |
|
800 { |
|
801 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
802 CImageEncoder::FileNewL( aFs, aDestinationFilename, |
|
803 aMIMEType, aOptions ) ); |
|
804 CleanupStack::PushL( enc ); |
|
805 if ( enc->CapabilitiesL() < ECapNone ) |
|
806 { |
|
807 User::Leave( KErrNotFound ); |
|
808 } |
|
809 CleanupStack::Pop(); |
|
810 return enc; |
|
811 } |
|
812 |
|
813 // --------------------------------------------------------- |
|
814 // CExtJpegEncoder* CExtJpegEncoder::FileNewL |
|
815 // Creates, initializes and returns a pointer to an object of |
|
816 // class CExtJpegEncoder |
|
817 // --------------------------------------------------------- |
|
818 // |
|
819 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::FileNewL( |
|
820 RFs& aFs, |
|
821 const TDesC& aDestinationFilename, |
|
822 const TOptions aOptions, |
|
823 const TUid aImageType, |
|
824 const TUid aImageSubType, |
|
825 const TUid aEncoderUid ) |
|
826 { |
|
827 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
828 CImageEncoder::FileNewL( aFs, aDestinationFilename, |
|
829 aOptions, aImageType, aImageSubType, aEncoderUid ) ); |
|
830 CleanupStack::PushL( enc ); |
|
831 if ( enc->CapabilitiesL() < ECapNone ) |
|
832 { |
|
833 User::Leave( KErrNotFound ); |
|
834 } |
|
835 CleanupStack::Pop(); |
|
836 return enc; |
|
837 } |
|
838 |
|
839 // --------------------------------------------------------- |
|
840 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
841 // Creates, initializes and returns a pointer to an object of |
|
842 // class CExtJpegEncoder |
|
843 // --------------------------------------------------------- |
|
844 // |
|
845 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
846 HBufC8*& aDestinationData, |
|
847 const TDesC8& aMIMEType, |
|
848 const TOptions aOptions ) |
|
849 { |
|
850 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
851 CImageEncoder::DataNewL( aDestinationData, |
|
852 aMIMEType, aOptions ) ); |
|
853 CleanupStack::PushL( enc ); |
|
854 if ( enc->CapabilitiesL() < ECapNone ) |
|
855 { |
|
856 User::Leave( KErrNotFound ); |
|
857 } |
|
858 CleanupStack::Pop(); |
|
859 return enc; |
|
860 } |
|
861 |
|
862 // --------------------------------------------------------- |
|
863 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
864 // Creates, initializes and returns a pointer to an object of |
|
865 // class CExtJpegEncoder |
|
866 // --------------------------------------------------------- |
|
867 // |
|
868 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
869 HBufC8*& aDestinationData, |
|
870 const TOptions aOptions, |
|
871 const TUid aImageType, |
|
872 const TUid aImageSubType, |
|
873 const TUid aEncoderUid ) |
|
874 { |
|
875 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
876 CImageEncoder::DataNewL( aDestinationData, |
|
877 aOptions, aImageType, aImageSubType, aEncoderUid ) ); |
|
878 CleanupStack::PushL( enc ); |
|
879 if ( enc->CapabilitiesL() < ECapNone ) |
|
880 { |
|
881 User::Leave( KErrNotFound ); |
|
882 } |
|
883 CleanupStack::Pop(); |
|
884 return enc; |
|
885 } |
|
886 |
|
887 // --------------------------------------------------------- |
|
888 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
889 // Creates, initializes and returns a pointer to an object of |
|
890 // class CExtJpegEncoder |
|
891 // --------------------------------------------------------- |
|
892 // |
|
893 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
894 const CVisualFrame* aDestinationData, |
|
895 const TDesC8& aMIMEType, |
|
896 const TOptions aOptions ) |
|
897 { |
|
898 HBufC8* tmp = NULL; |
|
899 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
900 CImageEncoder::DataNewL( tmp, |
|
901 aMIMEType, aOptions ) ); |
|
902 CleanupStack::PushL( enc ); |
|
903 if ( enc->CapabilitiesL() < ECapNone ) |
|
904 { |
|
905 User::Leave( KErrNotFound ); |
|
906 } |
|
907 enc->CustomSyncL( KExtensionUID ); |
|
908 enc->CustomSyncL( EDestVisualFrame ); |
|
909 enc->CustomSyncL( reinterpret_cast<TInt>( aDestinationData ) ); |
|
910 enc->CustomSyncL( EEnd ); |
|
911 CleanupStack::Pop(); |
|
912 return enc; |
|
913 } |
|
914 |
|
915 // --------------------------------------------------------- |
|
916 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
917 // Creates, initializes and returns a pointer to an object of |
|
918 // class CExtJpegEncoder |
|
919 // --------------------------------------------------------- |
|
920 // |
|
921 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
922 const CVisualFrame* aDestinationData, |
|
923 const TOptions aOptions, |
|
924 const TUid aImageType, |
|
925 const TUid aImageSubType, |
|
926 const TUid aEncoderUid ) |
|
927 { |
|
928 HBufC8* tmp = NULL; |
|
929 CExtJpegEncoder* enc = reinterpret_cast<CExtJpegEncoder*>( |
|
930 CImageEncoder::DataNewL( tmp, aOptions, |
|
931 aImageType, aImageSubType, aEncoderUid ) ); |
|
932 CleanupStack::PushL( enc ); |
|
933 if ( enc->CapabilitiesL() < ECapNone ) |
|
934 { |
|
935 User::Leave( KErrNotFound ); |
|
936 } |
|
937 enc->CustomSyncL( KExtensionUID ); |
|
938 enc->CustomSyncL( EDestVisualFrame ); |
|
939 enc->CustomSyncL( reinterpret_cast<TInt>( aDestinationData ) ); |
|
940 enc->CustomSyncL( EEnd ); |
|
941 CleanupStack::Pop(); |
|
942 return enc; |
|
943 } |
|
944 |
|
945 // --------------------------------------------------------- |
|
946 // CExtJpegEncoder::~CExtJpegEncoder |
|
947 // Destructor. |
|
948 // --------------------------------------------------------- |
|
949 // |
|
950 EXPORT_C CExtJpegEncoder::~CExtJpegEncoder() |
|
951 { |
|
952 } |
|
953 |
|
954 // --------------------------------------------------------- |
|
955 // CExtJpegEncoder::SetStreamingL |
|
956 // --------------------------------------------------------- |
|
957 // |
|
958 EXPORT_C void CExtJpegEncoder::SetStreamingL( TSize& aMacroBlockSize, |
|
959 const CFrameImageData* aFrameImageData ) |
|
960 { |
|
961 CustomSyncL( KExtensionUID ); |
|
962 CustomSyncL( ECapStreaming ); |
|
963 CustomSyncL( reinterpret_cast<TInt>( &aMacroBlockSize ) ); |
|
964 CustomSyncL( reinterpret_cast<TInt>( aFrameImageData ) ); |
|
965 CustomSyncL( EEnd ); |
|
966 } |
|
967 |
|
968 // --------------------------------------------------------- |
|
969 // CExtJpegEncoder::SetImageReplaceL |
|
970 // --------------------------------------------------------- |
|
971 // |
|
972 EXPORT_C void CExtJpegEncoder::SetImageReplaceL( const CVisualFrame* aReplaceImage, |
|
973 TPoint aReplacePoint ) |
|
974 { |
|
975 CustomSyncL( KExtensionUID ); |
|
976 CustomSyncL( ECapImageReplacing ); |
|
977 CustomSyncL( reinterpret_cast<TInt>( aReplaceImage ) ); |
|
978 CustomSyncL( reinterpret_cast<TInt>( &aReplacePoint ) ); |
|
979 CustomSyncL( EEnd ); |
|
980 } |
|
981 |
|
982 // --------------------------------------------------------- |
|
983 // CExtJpegEncoder::SetBitmapReplaceL |
|
984 // --------------------------------------------------------- |
|
985 // |
|
986 EXPORT_C void CExtJpegEncoder::SetBitmapReplaceL( const CFbsBitmap& aReplaceBitmap, |
|
987 TPoint aReplacePoint ) |
|
988 { |
|
989 CustomSyncL( KExtensionUID ); |
|
990 CustomSyncL( ECapBitmapReplacing ); |
|
991 CustomSyncL( reinterpret_cast<TInt>( &aReplaceBitmap ) ); |
|
992 CustomSyncL( reinterpret_cast<TInt>( &aReplacePoint ) ); |
|
993 CustomSyncL( EEnd ); |
|
994 } |
|
995 |
|
996 // --------------------------------------------------------- |
|
997 // CExtJpegEncoder::SetBitmapOverlayL |
|
998 // --------------------------------------------------------- |
|
999 // |
|
1000 EXPORT_C void CExtJpegEncoder::SetBitmapOverlayL( const CFbsBitmap& aOverlayBitmap, |
|
1001 TUint aAlphaValue, TPoint aOverlayPoint ) |
|
1002 { |
|
1003 CustomSyncL( KExtensionUID ); |
|
1004 CustomSyncL( ECapBitmapOverlay ); |
|
1005 CustomSyncL( reinterpret_cast<TInt>( &aOverlayBitmap ) ); |
|
1006 CustomSyncL( aAlphaValue ); |
|
1007 CustomSyncL( reinterpret_cast<TInt>( &aOverlayPoint ) ); |
|
1008 CustomSyncL( EEnd ); |
|
1009 } |
|
1010 |
|
1011 // --------------------------------------------------------- |
|
1012 // CExtJpegEncoder::SetLosslessRotationL |
|
1013 // --------------------------------------------------------- |
|
1014 // |
|
1015 EXPORT_C void CExtJpegEncoder::SetLosslessRotationL( TInt aDegree ) |
|
1016 { |
|
1017 CustomSyncL( KExtensionUID ); |
|
1018 CustomSyncL( ECapLosslessRotation ); |
|
1019 CustomSyncL( aDegree ); |
|
1020 CustomSyncL( EEnd ); |
|
1021 } |
|
1022 |
|
1023 // --------------------------------------------------------- |
|
1024 // CExtJpegEncoder::SetLosslessFlippingL |
|
1025 // --------------------------------------------------------- |
|
1026 // |
|
1027 EXPORT_C void CExtJpegEncoder::SetLosslessFlippingL() |
|
1028 { |
|
1029 CustomSyncL( KExtensionUID ); |
|
1030 CustomSyncL( ECapLosslessFlipping ); |
|
1031 CustomSyncL( EEnd ); |
|
1032 } |
|
1033 |
|
1034 // --------------------------------------------------------- |
|
1035 // CExtJpegEncoder::SetLosslessMirroringL |
|
1036 // --------------------------------------------------------- |
|
1037 // |
|
1038 EXPORT_C void CExtJpegEncoder::SetLosslessMirroringL() |
|
1039 { |
|
1040 CustomSyncL( KExtensionUID ); |
|
1041 CustomSyncL( ECapLosslessMirroring ); |
|
1042 CustomSyncL( EEnd ); |
|
1043 } |
|
1044 |
|
1045 // --------------------------------------------------------- |
|
1046 // CExtJpegEncoder::SetDctEncodingL |
|
1047 // --------------------------------------------------------- |
|
1048 // |
|
1049 EXPORT_C void CExtJpegEncoder::SetDctEncodingL() |
|
1050 { |
|
1051 CustomSyncL( KExtensionUID ); |
|
1052 CustomSyncL( ECapDctEncoding ); |
|
1053 CustomSyncL( EEnd ); |
|
1054 } |
|
1055 |
|
1056 // --------------------------------------------------------- |
|
1057 // CExtJpegEncoder::ProvideNewDestDataL |
|
1058 // --------------------------------------------------------- |
|
1059 // |
|
1060 EXPORT_C void CExtJpegEncoder::ProvideNewDestDataL( const CVisualFrame* aDestinationData ) |
|
1061 { |
|
1062 CustomSyncL( KExtensionUID ); |
|
1063 CustomSyncL( ENewDestData ); |
|
1064 CustomSyncL( reinterpret_cast<TInt>( aDestinationData ) ); |
|
1065 CustomSyncL( EEnd ); |
|
1066 } |
|
1067 |
|
1068 // --------------------------------------------------------- |
|
1069 // CExtJpegEncoder::ConvertL |
|
1070 // --------------------------------------------------------- |
|
1071 // |
|
1072 EXPORT_C void CExtJpegEncoder::ConvertL( |
|
1073 TRequestStatus* aRequestStatus, |
|
1074 const CVisualFrame* aSourceFrame, |
|
1075 TInt& aNoOfEncodedMBlocks, |
|
1076 const CFrameImageData* aFrameImageData ) |
|
1077 { |
|
1078 CustomSyncL( KExtensionUID ); |
|
1079 CustomSyncL( EConvert ); |
|
1080 CustomSyncL( reinterpret_cast<TInt>( aSourceFrame ) ); |
|
1081 CustomSyncL( reinterpret_cast<TInt>( &aNoOfEncodedMBlocks ) ); |
|
1082 CustomSyncL( reinterpret_cast<TInt>( aFrameImageData ) ); |
|
1083 CustomSyncL( EReadyForAsync ); |
|
1084 CustomAsync( aRequestStatus, 0 ); |
|
1085 } |
|
1086 |
|
1087 // --------------------------------------------------------- |
|
1088 // CExtJpegEncoder::ContinueConvertL |
|
1089 // --------------------------------------------------------- |
|
1090 // |
|
1091 EXPORT_C void CExtJpegEncoder::ContinueConvertL( |
|
1092 TRequestStatus* aRequestStatus, |
|
1093 const CVisualFrame* aSourceFrame, |
|
1094 TInt& aNoOfEncodedMBlocks ) |
|
1095 { |
|
1096 CustomSyncL( KExtensionUID ); |
|
1097 CustomSyncL( EContinueConvert ); |
|
1098 CustomSyncL( reinterpret_cast<TInt>( aSourceFrame ) ); |
|
1099 CustomSyncL( reinterpret_cast<TInt>( &aNoOfEncodedMBlocks ) ); |
|
1100 CustomSyncL( EReadyForAsync ); |
|
1101 CustomAsync( aRequestStatus, 0 ); |
|
1102 } |
|
1103 |
|
1104 // --------------------------------------------------------- |
|
1105 // CExtJpegEncoder::SupportedFormatsL |
|
1106 // --------------------------------------------------------- |
|
1107 // |
|
1108 EXPORT_C TInt CExtJpegEncoder::SupportedFormatsL() |
|
1109 { |
|
1110 CustomSyncL( KExtensionUID ); |
|
1111 CustomSyncL( ESupportedFormats ); |
|
1112 TInt retVal = KErrNotFound; |
|
1113 CustomSyncL( reinterpret_cast<TInt>( &retVal ) ); |
|
1114 CustomSyncL( EEnd ); |
|
1115 return retVal; |
|
1116 } |
|
1117 |
|
1118 // --------------------------------------------------------- |
|
1119 // CExtJpegEncoder::CapabilitiesL |
|
1120 // --------------------------------------------------------- |
|
1121 // |
|
1122 EXPORT_C TInt CExtJpegEncoder::CapabilitiesL() |
|
1123 { |
|
1124 CustomSyncL( KExtensionUID ); |
|
1125 CustomSyncL( ECapabilities ); |
|
1126 TInt retVal = KErrNotFound; |
|
1127 CustomSyncL( reinterpret_cast<TInt>( &retVal ) ); |
|
1128 CustomSyncL( EEnd ); |
|
1129 return retVal; |
|
1130 } |
|
1131 |
|
1132 // --------------------------------------------------------- |
|
1133 // CExtJpegEncoder::CExtJpegEncoder |
|
1134 // --------------------------------------------------------- |
|
1135 // |
|
1136 CExtJpegEncoder::CExtJpegEncoder() : CJPEGImageFrameEncoder() |
|
1137 { |
|
1138 } |
|
1139 |
|
1140 // --------------------------------------------------------- |
|
1141 // CExtJpegEncoder* CExtJpegEncoder::FileNewL |
|
1142 // Creates, initializes and returns a pointer to an object of |
|
1143 // class CExtJpegEncoder |
|
1144 // --------------------------------------------------------- |
|
1145 // |
|
1146 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::FileNewL( |
|
1147 const TEncoderType aEncoderType, |
|
1148 RFs& aFs, |
|
1149 const TDesC& aDestinationFilename, |
|
1150 const TOptions aOptions ) |
|
1151 { |
|
1152 TInt versionMin = KMinSwVersion; |
|
1153 TInt versionMax = KMaxSwVersion; |
|
1154 if ( aEncoderType == EHwImplementation ) |
|
1155 { |
|
1156 versionMin = KMinHwVersion; |
|
1157 versionMax = KMaxHwVersion; |
|
1158 } |
|
1159 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
1160 if ( uId == KNullUid ) |
|
1161 { |
|
1162 User::Leave( KErrNotFound ); |
|
1163 } |
|
1164 return CExtJpegEncoder::FileNewL( aFs, aDestinationFilename, aOptions, |
|
1165 KImageTypeJPGUid, KNullUid, uId ); |
|
1166 } |
|
1167 |
|
1168 // --------------------------------------------------------- |
|
1169 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
1170 // Creates, initializes and returns a pointer to an object of |
|
1171 // class CExtJpegEncoder |
|
1172 // --------------------------------------------------------- |
|
1173 // |
|
1174 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
1175 const TEncoderType aEncoderType, |
|
1176 HBufC8*& aDestinationData, |
|
1177 const TOptions aOptions ) |
|
1178 { |
|
1179 TInt versionMin = KMinSwVersion; |
|
1180 TInt versionMax = KMaxSwVersion; |
|
1181 if ( aEncoderType == EHwImplementation ) |
|
1182 { |
|
1183 versionMin = KMinHwVersion; |
|
1184 versionMax = KMaxHwVersion; |
|
1185 } |
|
1186 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
1187 if ( uId == KNullUid ) |
|
1188 { |
|
1189 User::Leave( KErrNotFound ); |
|
1190 } |
|
1191 return CExtJpegEncoder::DataNewL( aDestinationData, aOptions, |
|
1192 KImageTypeJPGUid, KNullUid, uId ); |
|
1193 |
|
1194 } |
|
1195 |
|
1196 // --------------------------------------------------------- |
|
1197 // CExtJpegEncoder* CExtJpegEncoder::DataNewL |
|
1198 // Creates, initializes and returns a pointer to an object of |
|
1199 // class CExtJpegEncoder |
|
1200 // --------------------------------------------------------- |
|
1201 // |
|
1202 EXPORT_C CExtJpegEncoder* CExtJpegEncoder::DataNewL( |
|
1203 const TEncoderType aEncoderType, |
|
1204 const CVisualFrame* aDestinationData, |
|
1205 const TOptions aOptions ) |
|
1206 { |
|
1207 TInt versionMin = KMinSwVersion; |
|
1208 TInt versionMax = KMaxSwVersion; |
|
1209 if ( aEncoderType == EHwImplementation ) |
|
1210 { |
|
1211 versionMin = KMinHwVersion; |
|
1212 versionMax = KMaxHwVersion; |
|
1213 } |
|
1214 TUid uId = GetUidByVersionRangeL( versionMin, versionMax ); |
|
1215 if ( uId == KNullUid ) |
|
1216 { |
|
1217 User::Leave( KErrNotFound ); |
|
1218 } |
|
1219 return CExtJpegEncoder::DataNewL( aDestinationData, aOptions, |
|
1220 KImageTypeJPGUid, KNullUid, uId ); |
|
1221 } |
|
1222 |
|
1223 // --------------------------------------------------------- |
|
1224 // CExtJpegEncoder::GetDestinationDataSizeL |
|
1225 // --------------------------------------------------------- |
|
1226 // |
|
1227 EXPORT_C TInt CExtJpegEncoder::GetDestinationDataSizeL() |
|
1228 { |
|
1229 CustomSyncL( KExtensionUID ); |
|
1230 CustomSyncL( EDestDataSize ); |
|
1231 TInt retVal = KErrNotFound; |
|
1232 CustomSyncL( reinterpret_cast<TInt>( &retVal ) ); |
|
1233 CustomSyncL( EEnd ); |
|
1234 return retVal; |
|
1235 } |
|
1236 |
|
1237 // --------------------------------------------------------- |
|
1238 // CExtJpegEncoder::GetUidByVersionRangeL |
|
1239 // --------------------------------------------------------- |
|
1240 // |
|
1241 TUid CExtJpegEncoder::GetUidByVersionRangeL( TInt aMinVersion, TInt aMaxVersion ) |
|
1242 { |
|
1243 TUid uId = KNullUid; |
|
1244 TUid propertyUid = KUidSwCodec; |
|
1245 |
|
1246 // based on the version decide what kind of codec to fetch |
|
1247 if( ( aMinVersion == KMinSwVersion ) && ( aMaxVersion == KMaxSwVersion ) ) |
|
1248 { |
|
1249 propertyUid = KUidSwCodec; |
|
1250 } |
|
1251 else if( ( aMinVersion == KMinHwVersion ) && ( aMaxVersion == KMaxHwVersion ) ) |
|
1252 { |
|
1253 propertyUid = KUidHwCodec; |
|
1254 } |
|
1255 |
|
1256 // property array to be verified |
|
1257 const TUid properties[] = { propertyUid, KImageTypeJPGUid }; |
|
1258 |
|
1259 RUidDataArray implArray; |
|
1260 // Request existing plugins with the desired properties |
|
1261 TRAPD( getIntErr, CImageEncoder::GetInterfaceImplementationsL( |
|
1262 properties, |
|
1263 2, |
|
1264 implArray ) ); |
|
1265 CleanupClosePushL( implArray ); |
|
1266 User::LeaveIfError( getIntErr ); |
|
1267 |
|
1268 TInt count = implArray.Count(); |
|
1269 for( --count; uId == KNullUid && count >= 0; --count ) |
|
1270 { |
|
1271 // Check all encoders and find the one having Jpeg mime type, |
|
1272 TUid tempUid = implArray[ count ]; |
|
1273 |
|
1274 // Get the same encoder UID and find out more info for testing |
|
1275 TUid uId2 = { KEncoderInterfaceUidValue }; |
|
1276 RImplInfoPtrArray implInfo; |
|
1277 REComSession::ListImplementationsL( uId2, implInfo ); |
|
1278 TInt count2 = implInfo.Count(); |
|
1279 uId2 = tempUid; |
|
1280 for ( --count2; uId == KNullUid && count2 >= 0; --count2 ) |
|
1281 { |
|
1282 CImplementationInformation& implInfoCur = *implInfo[count2]; |
|
1283 if ( ( implInfoCur.ImplementationUid() == uId2 ) && |
|
1284 ( implInfoCur.OpaqueData().Find( KJpgMimeType ) != KErrNotFound ) ) |
|
1285 { |
|
1286 uId = uId2; |
|
1287 } |
|
1288 } |
|
1289 implInfo.ResetAndDestroy(); |
|
1290 } // for - count |
|
1291 |
|
1292 CleanupStack::PopAndDestroy( &implArray ); |
|
1293 return uId; |
|
1294 } |
|
1295 |
|
1296 // End of File |