imaging/imagingfws/src/ImageRelay.cpp
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     1 // Copyright (c) 2002-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 "ImageRelay.h"
       
    17 #include "icl/ImageConstruct.h"
       
    18 #include "ImageClientMain.h"
       
    19 #include "ImageStraightRelay.h"
       
    20 #include "ThreadRelay.h"
       
    21 #include "ImageClientMain.h"
       
    22 #include "fwextconstants.h"
       
    23 //
       
    24 // MImageDecoderRelay
       
    25 //
       
    26 MImageDecoderRelay* MImageDecoderRelay::NewL(CImageDecodeConstruct* aConstruct, TBool aAlwaysThread)
       
    27 	{
       
    28 	TBool wantThread = aAlwaysThread || aConstruct->RequestThread();
       
    29 
       
    30 	if (wantThread)
       
    31 		return CThreadDecoderRelay::NewL(aConstruct);
       
    32 	else
       
    33 		return CImageDecoderStraightRelay::NewL(aConstruct);
       
    34 	}
       
    35 
       
    36 MImageDecoderRelay::~MImageDecoderRelay()
       
    37 	{
       
    38 	}
       
    39 
       
    40 //
       
    41 // CImageConvExtensionCache
       
    42 //
       
    43 CImageConvExtensionCache* CImageConvExtensionCache::NewL()
       
    44 	{
       
    45 	return new (ELeave) CImageConvExtensionCache();
       
    46 	}
       
    47 
       
    48 CImageConvExtensionCache::~CImageConvExtensionCache()
       
    49 	{
       
    50 	iProxyList.ResetAndDestroy();
       
    51 	
       
    52 	delete iOperationExtension;
       
    53 	iOperationExtension = NULL;
       
    54 	delete iScalerExtension;
       
    55 	iScalerExtension = NULL;
       
    56 	delete iStreamedDecodeExtension;
       
    57 	iStreamedDecodeExtension = NULL;
       
    58 	delete iStreamedEncodeExtension;
       
    59 	iStreamedEncodeExtension = NULL;
       
    60 	}
       
    61 	
       
    62 TImageConvOperation* CImageConvExtensionCache::Operation()
       
    63 	{
       
    64 	return iOperationExtension;
       
    65 	}
       
    66 	
       
    67 TImageConvScaler* CImageConvExtensionCache::Scaler()
       
    68 	{
       
    69 	return iScalerExtension;
       
    70 	}
       
    71 	
       
    72 TImageConvStreamedDecode* CImageConvExtensionCache::DecodeBlockStreamer()
       
    73 	{
       
    74 	return iStreamedDecodeExtension;
       
    75 	}
       
    76 	
       
    77 TImageConvStreamedEncode* CImageConvExtensionCache::EncodeBlockStreamer()
       
    78 	{
       
    79 	return iStreamedEncodeExtension;
       
    80 	}
       
    81 
       
    82 TImageConvPrepare* CImageConvExtensionCache::Prepare()
       
    83 	{
       
    84 	return iPrepareExtension;
       
    85 	}
       
    86 	
       
    87 void CImageConvExtensionCache::SetOperationExtension(TImageConvOperation* aOperationExtension)
       
    88 	{
       
    89 	__ASSERT_ALWAYS(!iOperationExtension, Panic(EExtensionAlreadySet));
       
    90 	iOperationExtension = aOperationExtension;
       
    91 	}
       
    92 
       
    93 void CImageConvExtensionCache::SetScalerExtension(TImageConvScaler* aScalerExtension)
       
    94 	{
       
    95 	__ASSERT_ALWAYS(!iScalerExtension, Panic(EExtensionAlreadySet));
       
    96 	iScalerExtension = aScalerExtension;
       
    97 	}
       
    98 
       
    99 void CImageConvExtensionCache::SetBlockStreamerExtension(TImageConvStreamedDecode* aStreamedDecodeExtension)
       
   100 	{
       
   101 	__ASSERT_ALWAYS(!iStreamedDecodeExtension, Panic(EExtensionAlreadySet));
       
   102 	iStreamedDecodeExtension = aStreamedDecodeExtension;
       
   103 	}
       
   104 	
       
   105 void CImageConvExtensionCache::SetBlockStreamerExtension(TImageConvStreamedEncode* aStreamedEncodeExtension)
       
   106 	{
       
   107 	__ASSERT_ALWAYS(!iStreamedEncodeExtension, Panic(EExtensionAlreadySet));
       
   108 	iStreamedEncodeExtension = aStreamedEncodeExtension;
       
   109 	}
       
   110 
       
   111 void CImageConvExtensionCache::SetPrepareExtension(TImageConvPrepare* aPrepareExtension)
       
   112 	{
       
   113 	__ASSERT_ALWAYS(!iPrepareExtension, Panic(EExtensionAlreadySet));
       
   114 	iPrepareExtension = aPrepareExtension;
       
   115 	}
       
   116 
       
   117 void CImageConvExtensionCache::SetProxyL(CImageConvProxyBase* aProxy)
       
   118 	{
       
   119 	iProxyList.AppendL(aProxy);
       
   120 	}
       
   121 
       
   122 //
       
   123 // MImageEncoderRelay
       
   124 //
       
   125 
       
   126 MImageEncoderRelay* MImageEncoderRelay::NewL(CImageEncodeConstruct* aConstruct, TBool aAlwaysThread)
       
   127 	{
       
   128 	TBool wantThread = aAlwaysThread || aConstruct->RequestThread();
       
   129 
       
   130 	if (wantThread)
       
   131 		return CThreadEncoderRelay::NewL(aConstruct);
       
   132 	else
       
   133 		return CImageEncoderStraightRelay::NewL(aConstruct);
       
   134 	}
       
   135 
       
   136 MImageEncoderRelay::~MImageEncoderRelay()
       
   137 	{
       
   138 	}
       
   139 
       
   140 TImageConvPrepare::TImageConvPrepare()
       
   141 : iExtension(NULL)
       
   142 	{
       
   143 	}
       
   144 	
       
   145 void TImageConvPrepare::Prepare(TRequestStatus* aStatus)
       
   146 	{
       
   147 	__ASSERT_ALWAYS(iExtension != NULL, Panic(ENullImageConvExtension));
       
   148 	return iExtension->Prepare(aStatus);
       
   149 	}
       
   150 	
       
   151 void TImageConvPrepare::SetExtension(MImageConvExtension* aExtension)
       
   152 	{
       
   153 	__ASSERT_ALWAYS(aExtension->Uid() == KICLPrepareUid, Panic(EInvalidFwExtensionUid));
       
   154 	iExtension = static_cast<MImageConvPrepare*>(aExtension);
       
   155 	}
       
   156