imaging/imagingfws/src/ImageStraightRelay.cpp
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     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 #include <caf/caf.h>
       
    17 using namespace ContentAccess;
       
    18 
       
    19 #include "ImageStraightRelay.h"
       
    20 #include "icl/ImageConstruct.h"
       
    21 #include "icl/ImagePlugin.h"
       
    22 #include "icl/ICL_UIDS.hrh"
       
    23 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    24 #include <icl/icl_uids_const.hrh>
       
    25 #include <icl/icl_uids_def.hrh>
       
    26 #endif
       
    27 #include "fwextconstants.h"
       
    28 #include "ImageClientMain.h"
       
    29 #include "iclextproxystubutil.h"
       
    30 
       
    31 //
       
    32 // CImageDecoderStraightRelay
       
    33 //
       
    34 
       
    35 CImageDecoderStraightRelay* CImageDecoderStraightRelay::NewL(CImageDecodeConstruct* aConstruct)
       
    36 	{
       
    37 	CImageDecoderStraightRelay* self = new (ELeave) CImageDecoderStraightRelay(aConstruct);
       
    38 	CleanupStack::PushL(self);
       
    39 	self->ConstructL();
       
    40 	CleanupStack::Pop(self);
       
    41 	return self;
       
    42 	}
       
    43 
       
    44 CImageDecoderStraightRelay::CImageDecoderStraightRelay(CImageDecodeConstruct* aConstruct):
       
    45 	iConstruct(aConstruct)
       
    46 	{}
       
    47 
       
    48 void CImageDecoderStraightRelay::ConstructL()
       
    49 	{
       
    50 	iBody = CImageDecoderPriv::NewL(iConstruct, this);
       
    51 	iBody->CreatePluginL();
       
    52 	iExtensionCache = CImageConvExtensionCache::NewL();
       
    53 	}
       
    54 
       
    55 CImageDecoderStraightRelay::~CImageDecoderStraightRelay()
       
    56 	{
       
    57 	Cancel();
       
    58 	delete iExtensionCache;
       
    59 	delete iBody;
       
    60 	if (iOwnConstruct)
       
    61 		{
       
    62 		delete iConstruct;
       
    63 		}
       
    64 	}
       
    65 
       
    66 void CImageDecoderStraightRelay::Cancel()
       
    67 	{
       
    68 	if (iBody)
       
    69 		iBody->Cancel();
       
    70 	}
       
    71 
       
    72 // forwarding functions
       
    73 
       
    74 void CImageDecoderStraightRelay::SetFileL(RFs& aFs, const TDesC& aSourceFilename, const CImageDecoder::TOptions aOptions)
       
    75 	{
       
    76 	iBody->SetFileL(aFs, aSourceFilename, aOptions);
       
    77 	}
       
    78 
       
    79 void CImageDecoderStraightRelay::SetFileL(RFile& aFile, const CImageDecoder::TOptions aOptions)
       
    80 	{
       
    81 	iBody->SetFileL(aFile, aOptions);
       
    82 	}
       
    83 
       
    84 void CImageDecoderStraightRelay::SetDataL(RFs& aFs, const TDesC8& aSourceData, const CImageDecoder::TOptions aOptions)
       
    85 	{
       
    86 	iBody->SetDataL(aFs, aSourceData, aOptions);
       
    87 	}
       
    88 
       
    89 CImageDecoderPlugin* CImageDecoderStraightRelay::Plugin() const
       
    90 	{
       
    91 	return iBody->Plugin();
       
    92 	}
       
    93 
       
    94 void CImageDecoderStraightRelay::HandleNewlyOpenedImageL()
       
    95 	{
       
    96 	iBody->HandleNewlyOpenedImageL();
       
    97 	}
       
    98 
       
    99 void CImageDecoderStraightRelay::Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber)
       
   100 	{
       
   101 	iBody->Convert(iMyThread, aRequestStatus, aDestination, aFrameNumber);
       
   102 	}
       
   103 
       
   104 void CImageDecoderStraightRelay::Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber)
       
   105 	{
       
   106 	iBody->Convert(iMyThread, aRequestStatus, aDestination, aDestinationMask, aFrameNumber);
       
   107 	}
       
   108 
       
   109 void CImageDecoderStraightRelay::SetImageTypeL(TInt aImageType)
       
   110 	{
       
   111 	iBody->SetImageTypeL(aImageType);
       
   112 	}
       
   113 
       
   114 void CImageDecoderStraightRelay::ContinueConvert(TRequestStatus* aRequestStatus)
       
   115 	{
       
   116 	iBody->ContinueConvert(iMyThread, aRequestStatus);
       
   117 	}
       
   118 
       
   119 void CImageDecoderStraightRelay::ContinueProcessingHeaderL()
       
   120 	{
       
   121 	iBody->ContinueProcessingHeaderL();
       
   122 	}
       
   123 
       
   124 const TFrameInfo& CImageDecoderStraightRelay::FrameInfo(TInt aFrameNumber) const
       
   125 	{
       
   126 	return iBody->FrameInfo(aFrameNumber);
       
   127 	}
       
   128 
       
   129 CFrameInfoStrings* CImageDecoderStraightRelay::FrameInfoStringsLC(TInt aFrameNumber)
       
   130 	{
       
   131 	return iBody->FrameInfoStringsLC(aFrameNumber);
       
   132 	}
       
   133 
       
   134 TUid CImageDecoderStraightRelay::ImplementationUid() const
       
   135 	{
       
   136 	return iBody->ImplementationUid();
       
   137 	}
       
   138 
       
   139 TInt CImageDecoderStraightRelay::FrameCount() const
       
   140 	{
       
   141 	return iBody->FrameCount();
       
   142 	}
       
   143 
       
   144 TBool CImageDecoderStraightRelay::IsImageHeaderProcessingComplete() const
       
   145 	{
       
   146 	return iBody->IsImageHeaderProcessingComplete();
       
   147 	}
       
   148 
       
   149 const CFrameImageData& CImageDecoderStraightRelay::FrameData(TInt aFrameNumber) const
       
   150 	{
       
   151 	return iBody->FrameData(aFrameNumber);
       
   152 	}
       
   153 
       
   154 TInt CImageDecoderStraightRelay::NumberOfImageComments() const
       
   155 	{
       
   156 	return Plugin()->NumberOfImageComments();
       
   157 	}
       
   158 
       
   159 HBufC* CImageDecoderStraightRelay::ImageCommentL(TInt aCommentNumber) const
       
   160 	{
       
   161 	return Plugin()->ImageCommentL(aCommentNumber);
       
   162 	}
       
   163 
       
   164 TInt CImageDecoderStraightRelay::NumberOfFrameComments(TInt aFrameNumber) const
       
   165 	{
       
   166 	return Plugin()->NumberOfFrameComments(aFrameNumber);
       
   167 	}
       
   168 
       
   169 HBufC* CImageDecoderStraightRelay::FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const
       
   170 	{
       
   171 	return Plugin()->FrameCommentL(aFrameNumber, aCommentNumber);
       
   172 	}
       
   173 
       
   174 void CImageDecoderStraightRelay::CustomSyncL(TInt aParam)
       
   175 	{
       
   176 	iBody->CustomSyncL(aParam);
       
   177 	}
       
   178 
       
   179 void CImageDecoderStraightRelay::CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)
       
   180 	{
       
   181 	iBody->CustomAsync(iMyThread, aRequestStatus, aParam);
       
   182 	}
       
   183 
       
   184 void CImageDecoderStraightRelay::TransferConstructOwnership()
       
   185 	{
       
   186 	iOwnConstruct = ETrue;
       
   187 	}
       
   188 
       
   189 TBool CImageDecoderStraightRelay::MustUseBufferWithDescriptor() const
       
   190 	{
       
   191 	return EFalse;
       
   192 	}
       
   193 
       
   194 void CImageDecoderStraightRelay::CopyBufferToDescriptor(TDes8& aBuffer, const TDesC8& aSource, TInt aPosition, TInt aSize)
       
   195 	{
       
   196 	ASSERT(EFalse); // should never get here
       
   197 	aBuffer = aSource.Mid(aPosition, aSize); // but this is the required behaviour if we were to
       
   198 	}
       
   199 
       
   200 TBool CImageDecoderStraightRelay::AmInThread() const
       
   201 	{
       
   202 	return EFalse;
       
   203 	}
       
   204 
       
   205 TBool CImageDecoderStraightRelay::ShouldAbort() const
       
   206 	{
       
   207 	return EFalse;
       
   208 	}
       
   209 
       
   210 void CImageDecoderStraightRelay::Lock()
       
   211 	{
       
   212 	}
       
   213 
       
   214 void CImageDecoderStraightRelay::Unlock()
       
   215 	{
       
   216 	}
       
   217 
       
   218 void CImageDecoderStraightRelay::SaveFrameCount(TInt /*aFrameCount*/)
       
   219 	{
       
   220 	}
       
   221 
       
   222 void CImageDecoderStraightRelay::SetIntent(TIntent aIntent)
       
   223 	{
       
   224 	iBody->SetIntent(aIntent);
       
   225 	}
       
   226 
       
   227 void CImageDecoderStraightRelay::SetUniqueIdL(const TDesC& aUniqueId)
       
   228 	{
       
   229 	iBody->SetUniqueIdL(aUniqueId);
       
   230 	}
       
   231 
       
   232 TInt CImageDecoderStraightRelay::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue)
       
   233 	{
       
   234 	return iBody->SetAgentProperty(aProperty, aValue);
       
   235 	}
       
   236 
       
   237 TInt CImageDecoderStraightRelay::ReductionFactor(const TSize& aOriginalSize, const TSize& aReducedSize) const
       
   238 	{
       
   239 	return iBody->ReductionFactor(aOriginalSize, aReducedSize);
       
   240 	}
       
   241 	
       
   242 TInt CImageDecoderStraightRelay::ReducedSize(const TSize& aOriginalSize, TInt aReductionFactor, TSize& aReducedSize) const	
       
   243 	{
       
   244 	return iBody->ReducedSize(aOriginalSize, aReductionFactor, aReducedSize);
       
   245 	}
       
   246 	
       
   247 TInt CImageDecoderStraightRelay::SetDecoderThreadPriority(TThreadPriority /*aPriority*/)
       
   248 	{
       
   249 	return KErrNotSupported;
       
   250 	}
       
   251 	
       
   252 void CImageDecoderStraightRelay::GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr)
       
   253 	{
       
   254 	__ASSERT_ALWAYS(aExtPtr == NULL, Panic(ENonNullImageConvExtension));
       
   255 	
       
   256 	CImageConvProxyBase* proxy = ProxyStubUtility::GetNewStraightProxyL(aExtUid, iBody, iMyThread);
       
   257 	CleanupStack::PushL(proxy);
       
   258 	iBody->GetExtensionL(aExtUid, aExtPtr);
       
   259 	proxy->SetupExtension(aExtPtr);
       
   260 	iExtensionCache->SetProxyL(proxy);
       
   261 	CleanupStack::Pop(proxy);
       
   262 	//aExtPtr contains pointer to the proxy
       
   263 	}
       
   264 
       
   265 void CImageDecoderStraightRelay::SetClippingRectL(const TRect* aClipRect)
       
   266 	{
       
   267 	iBody->SetClippingRectL(aClipRect);
       
   268 	}
       
   269 
       
   270 TInt CImageDecoderStraightRelay::GetDestinationSize(TSize& aSize, TInt aFrameNumber)
       
   271 	{
       
   272 	return iBody->GetDestinationSize(aSize, aFrameNumber);
       
   273 	}
       
   274 	
       
   275 CImageConvExtensionCache& CImageDecoderStraightRelay::ExtensionCache()
       
   276 	{
       
   277 	return *iExtensionCache;
       
   278 	}
       
   279 
       
   280 //
       
   281 // CImageEncoderStraightRelay
       
   282 //
       
   283 
       
   284 CImageEncoderStraightRelay* CImageEncoderStraightRelay::NewL(CImageEncodeConstruct* aConstruct)
       
   285 	{
       
   286 	CImageEncoderStraightRelay* self = new (ELeave) CImageEncoderStraightRelay(aConstruct);
       
   287 	CleanupStack::PushL(self);
       
   288 	self->ConstructL();
       
   289 	CleanupStack::Pop(self);
       
   290 	return self;
       
   291 	}
       
   292 
       
   293 CImageEncoderStraightRelay::CImageEncoderStraightRelay(CImageEncodeConstruct* aConstruct):
       
   294 	iConstruct(aConstruct)
       
   295 	{}
       
   296 
       
   297 void CImageEncoderStraightRelay::ConstructL()
       
   298 	{
       
   299 	iBody = CImageEncoderPriv::NewL(iConstruct, this);
       
   300 	iBody->CreatePluginL();
       
   301 	iExtensionCache = CImageConvExtensionCache::NewL();
       
   302 	}
       
   303 
       
   304 CImageEncoderStraightRelay::~CImageEncoderStraightRelay()
       
   305 	{
       
   306 	Cancel();
       
   307 	delete iExtensionCache;
       
   308 	delete iBody;
       
   309 	if (iOwnConstruct)
       
   310 		delete iConstruct;
       
   311 	}
       
   312 
       
   313 void CImageEncoderStraightRelay::Cancel()
       
   314 	{
       
   315 	if (iBody)
       
   316 		iBody->Cancel();
       
   317 	}
       
   318 
       
   319 // forwarding functions
       
   320 
       
   321 void CImageEncoderStraightRelay::SetFileL(RFs& aFs, const TDesC& aDestinationFilename, const CImageEncoder::TOptions aOptions)
       
   322 	{
       
   323 	iBody->SetFileL(aFs, aDestinationFilename, aOptions);
       
   324 	}
       
   325 void CImageEncoderStraightRelay::SetFileL(RFile& aFile, const CImageEncoder::TOptions aOptions)
       
   326 	{
       
   327 	iBody->SetFileL(aFile, aOptions);
       
   328 	}
       
   329 
       
   330 void CImageEncoderStraightRelay::SetDataL(HBufC8*& aDestinationData, const CImageEncoder::TOptions aOptions)
       
   331 	{
       
   332 	iBody->SetDataL(aDestinationData, aOptions);
       
   333 	}
       
   334 
       
   335 CImageEncoderPlugin* CImageEncoderStraightRelay::Plugin() const
       
   336 	{
       
   337 	return iBody->Plugin();
       
   338 	}
       
   339 
       
   340 void CImageEncoderStraightRelay::Convert(TRequestStatus* aRequestStatus, const CFbsBitmap& aSource, const CFrameImageData* aFrameImageData)
       
   341 	{
       
   342 	iBody->Convert(iMyThread, aRequestStatus, aSource, aFrameImageData);
       
   343 	}
       
   344 
       
   345 TUid CImageEncoderStraightRelay::ImplementationUid() const
       
   346 	{
       
   347 	return iBody->ImplementationUid();
       
   348 	}
       
   349 
       
   350 void CImageEncoderStraightRelay::CustomSyncL(TInt aParam)
       
   351 	{
       
   352 	iBody->CustomSyncL(aParam);
       
   353 	}
       
   354 
       
   355 void CImageEncoderStraightRelay::CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)
       
   356 	{
       
   357 	iBody->CustomAsync(iMyThread, aRequestStatus, aParam);
       
   358 	}
       
   359 
       
   360 void CImageEncoderStraightRelay::TransferConstructOwnership()
       
   361 	{
       
   362 	iOwnConstruct = ETrue;
       
   363 	}
       
   364 
       
   365 TBool CImageEncoderStraightRelay::AmInThread() const
       
   366 	{
       
   367 	return EFalse;
       
   368 	}
       
   369 
       
   370 TBool CImageEncoderStraightRelay::ShouldAbort() const
       
   371 	{
       
   372 	return EFalse;
       
   373 	}
       
   374 
       
   375 void CImageEncoderStraightRelay::SetThumbnail(TBool aDoGenerateThumbnail)
       
   376 	{
       
   377 	iBody->SetThumbnail(aDoGenerateThumbnail);
       
   378 	}
       
   379 
       
   380 TInt CImageEncoderStraightRelay::SetEncoderThreadPriority(TThreadPriority /*aPriority*/)
       
   381 	{
       
   382 	return KErrNotSupported;
       
   383 	}
       
   384 
       
   385 void CImageEncoderStraightRelay::GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr)
       
   386 	{
       
   387 	__ASSERT_ALWAYS(aExtPtr == NULL, Panic(ENonNullImageConvExtension));
       
   388 	
       
   389 	CImageConvProxyBase* proxy = ProxyStubUtility::GetNewStraightProxyL(aExtUid, iBody, iMyThread);
       
   390 	CleanupStack::PushL(proxy);
       
   391 	iBody->GetExtensionL(aExtUid, aExtPtr);
       
   392 	proxy->SetupExtension(aExtPtr);
       
   393 	iExtensionCache->SetProxyL(proxy);
       
   394 	CleanupStack::Pop(proxy);
       
   395 	//aExtPtr contains pointer to the proxy
       
   396 	}
       
   397 
       
   398 CImageConvExtensionCache& CImageEncoderStraightRelay::ExtensionCache()
       
   399 	{
       
   400 	return *iExtensionCache;
       
   401 	}
       
   402 
       
   403 
       
   404