|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __IMAGERELAY_H__ |
|
17 #define __IMAGERELAY_H__ |
|
18 |
|
19 #include <caf/caf.h> |
|
20 using namespace ContentAccess; |
|
21 |
|
22 #include "icl/ImageCodec.h" |
|
23 #include "icl/ImageData.h" |
|
24 #include "ImageConversionPriv.h" |
|
25 #include "ImageConversion.h" |
|
26 #include "ImagePrivSupport.h" |
|
27 #include "icl/imageconversionextension.h" |
|
28 #include "fwextensionparams.h" |
|
29 |
|
30 // Forward declaration |
|
31 class CImageConvExtensionCache; |
|
32 class CImageConvProxyBase; |
|
33 |
|
34 class MImageDecoderRelay; // declared here |
|
35 /** |
|
36 * Abstract relay between CImageDecoder and CImageDecoderPriv |
|
37 * |
|
38 */ |
|
39 NONSHARABLE_CLASS( MImageDecoderRelay ) |
|
40 { |
|
41 public: |
|
42 static MImageDecoderRelay* NewL(CImageDecodeConstruct* aConstruct, TBool aAlwaysThread); // this passes ownership of aConstruct |
|
43 virtual ~MImageDecoderRelay(); |
|
44 virtual void Cancel()=0; |
|
45 |
|
46 virtual void SetFileL(RFs& aFs, const TDesC& aSourceFilename, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone)=0; |
|
47 virtual void SetFileL(RFile& name, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone)=0; |
|
48 virtual void SetDataL(RFs& aFs, const TDesC8& aSourceData, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone)=0; |
|
49 |
|
50 virtual CImageDecoderPlugin* Plugin() const=0; |
|
51 |
|
52 virtual void HandleNewlyOpenedImageL()=0; |
|
53 |
|
54 virtual void SetImageTypeL(TInt aImageType)=0; |
|
55 virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber)=0; |
|
56 virtual void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0)=0; |
|
57 virtual void ContinueConvert(TRequestStatus* aRequestStatus)=0; |
|
58 |
|
59 virtual void ContinueProcessingHeaderL()=0; |
|
60 |
|
61 virtual const TFrameInfo& FrameInfo(TInt aFrameNumber) const=0; |
|
62 virtual CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber)=0; |
|
63 |
|
64 virtual TUid ImplementationUid() const=0; |
|
65 |
|
66 virtual TInt FrameCount() const=0; |
|
67 virtual TBool IsImageHeaderProcessingComplete() const=0; |
|
68 virtual const CFrameImageData& FrameData(TInt aFrameNumber) const=0; |
|
69 |
|
70 virtual TInt NumberOfImageComments() const=0; |
|
71 virtual HBufC* ImageCommentL(TInt aCommentNumber) const=0; |
|
72 virtual TInt NumberOfFrameComments(TInt aFrameNumber) const=0; |
|
73 virtual HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const=0; |
|
74 |
|
75 // custom command support |
|
76 virtual void CustomSyncL(TInt aParam)=0; |
|
77 virtual void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)=0; |
|
78 |
|
79 virtual void TransferConstructOwnership()=0; |
|
80 virtual void SetIntent(TIntent aIntent)=0; |
|
81 |
|
82 virtual void SetUniqueIdL(const TDesC& aUniqueId)=0; |
|
83 virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue)=0; |
|
84 |
|
85 virtual TInt ReductionFactor(const TSize& aOriginalSize, const TSize& aReducedSize) const=0; |
|
86 virtual TInt ReducedSize(const TSize& aOriginalSize, TInt aReductionFactor, TSize& aReducedSize) const=0; |
|
87 virtual TInt SetDecoderThreadPriority(TThreadPriority aPriority) = 0; |
|
88 |
|
89 // Framework extension |
|
90 virtual void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr)=0; |
|
91 virtual void SetClippingRectL(const TRect* aClipRect)=0; |
|
92 virtual TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber = 0)=0; |
|
93 virtual CImageConvExtensionCache& ExtensionCache()=0; |
|
94 }; |
|
95 |
|
96 // Abstract relay between CImageEncoder and CImageEncoderPriv |
|
97 class MImageEncoderRelay; // declared here |
|
98 NONSHARABLE_CLASS( MImageEncoderRelay ) |
|
99 { |
|
100 public: |
|
101 static MImageEncoderRelay* NewL(CImageEncodeConstruct* aConstruct, TBool aAlwaysThread); // this passes ownership of aConstruct |
|
102 virtual ~MImageEncoderRelay(); |
|
103 virtual void Cancel()=0; |
|
104 |
|
105 virtual void SetFileL(RFs& aFs, const TDesC& aDestinationFilename, const CImageEncoder::TOptions aOptions)=0; |
|
106 virtual void SetFileL(RFile& name, const CImageEncoder::TOptions aOptions)=0; |
|
107 virtual void SetDataL(HBufC8*& aDestinationData, const CImageEncoder::TOptions aOptions)=0; |
|
108 |
|
109 virtual CImageEncoderPlugin* Plugin() const=0; |
|
110 |
|
111 virtual void Convert(TRequestStatus* aRequestStatus, const CFbsBitmap& aSource, const CFrameImageData* aFrameImageData)=0; |
|
112 virtual void SetThumbnail(TBool aDoGenerateThumbnail)=0; |
|
113 |
|
114 virtual TUid ImplementationUid() const=0; |
|
115 |
|
116 // custom command support |
|
117 virtual void CustomSyncL(TInt aParam)=0; |
|
118 virtual void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)=0; |
|
119 |
|
120 virtual void TransferConstructOwnership()=0; |
|
121 |
|
122 virtual TInt SetEncoderThreadPriority(TThreadPriority aPriority) = 0; |
|
123 |
|
124 // Framework extension |
|
125 virtual void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr)=0; |
|
126 virtual CImageConvExtensionCache& ExtensionCache()=0; |
|
127 }; |
|
128 |
|
129 // Interface required for framework extension support |
|
130 class MImageConvExtensionThreadedSupport |
|
131 { |
|
132 public: |
|
133 virtual void ExecuteCommand(TExecuteCommandParamsBase& aExecuteCommandBase) = 0; |
|
134 virtual void ExecuteCommandL(TExecuteCommandParamsBase& aExecuteCommandBase) = 0; |
|
135 virtual void ExecuteAsyncCommand(TExecuteCommandParamsBase& aExecuteCommandBase) = 0; |
|
136 }; |
|
137 |
|
138 /** |
|
139 Prepare extension. |
|
140 */ |
|
141 NONSHARABLE_CLASS(TImageConvPrepare) |
|
142 { |
|
143 friend class CImageDecoder; |
|
144 friend class CImageEncoder; |
|
145 |
|
146 public: |
|
147 void Prepare(TRequestStatus* aRequestStatus); |
|
148 |
|
149 private: |
|
150 TImageConvPrepare(); |
|
151 void SetExtension(MImageConvExtension* aExtension); |
|
152 |
|
153 private: |
|
154 MImageConvPrepare* iExtension; |
|
155 }; |
|
156 |
|
157 // Class used by relay to hold extension pointers |
|
158 NONSHARABLE_CLASS( CImageConvExtensionCache ) : public CBase |
|
159 { |
|
160 public: |
|
161 static CImageConvExtensionCache* NewL(); |
|
162 ~CImageConvExtensionCache(); |
|
163 |
|
164 TImageConvOperation* Operation(); |
|
165 TImageConvScaler* Scaler(); |
|
166 TImageConvStreamedDecode* DecodeBlockStreamer(); |
|
167 TImageConvStreamedEncode* EncodeBlockStreamer(); |
|
168 TImageConvPrepare* Prepare(); |
|
169 |
|
170 void SetOperationExtension(TImageConvOperation* aOperationExtension); |
|
171 void SetScalerExtension(TImageConvScaler* aScalerExtension); |
|
172 void SetBlockStreamerExtension(TImageConvStreamedDecode* aStreamedDecodeExtension); |
|
173 void SetBlockStreamerExtension(TImageConvStreamedEncode* aStreamedEncodeExtension); |
|
174 void SetPrepareExtension(TImageConvPrepare* aPrepareExtension); |
|
175 |
|
176 void SetProxyL(CImageConvProxyBase* aProxy); |
|
177 void SetExtensionL(TUid aExtUid, MImageConvExtension*& aExtension); |
|
178 |
|
179 private: |
|
180 RPointerArray<CImageConvProxyBase> iProxyList; |
|
181 |
|
182 TImageConvOperation* iOperationExtension; |
|
183 TImageConvScaler* iScalerExtension; |
|
184 TImageConvStreamedDecode* iStreamedDecodeExtension; |
|
185 TImageConvStreamedEncode* iStreamedEncodeExtension; |
|
186 TImageConvPrepare* iPrepareExtension; |
|
187 }; |
|
188 |
|
189 #endif // __IMAGERELAY_H__ |
|
190 |