imaging/imagingunittest/testcodec/src/ExtendedPlugin.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 "ExtendedPlugin.h"
       
    17 
       
    18 //CExtendedDecoder
       
    19 EXPORT_C CExtendedDecoder* CExtendedDecoder::NewL()
       
    20 	{
       
    21 	CExtendedDecoder* self;
       
    22 	self = new (ELeave) CExtendedDecoder;
       
    23 	return self;
       
    24 	}
       
    25 
       
    26 CExtendedDecoder::CExtendedDecoder()
       
    27 	{
       
    28 	}
       
    29 
       
    30 EXPORT_C TInt CExtendedDecoder::SyncResult() const
       
    31 	{
       
    32 	CExtendedDecoderPlugin* plugin;
       
    33 	plugin = static_cast<CExtendedDecoderPlugin*>(Plugin());
       
    34 	return plugin->iSyncResult;
       
    35 	}
       
    36 
       
    37 EXPORT_C TInt CExtendedDecoder::AsyncResult() const
       
    38 	{
       
    39 	CExtendedDecoderPlugin* plugin;
       
    40 	plugin = static_cast<CExtendedDecoderPlugin*>(Plugin());
       
    41 	return plugin->iAsyncResult;
       
    42 	}
       
    43 
       
    44 EXPORT_C TBool CExtendedDecoder::UsingThread() const
       
    45 	{
       
    46 	CExtendedDecoderPlugin* plugin;
       
    47 	plugin = static_cast<CExtendedDecoderPlugin*>(Plugin());
       
    48 	return plugin->UsingThread();
       
    49 	}
       
    50 
       
    51 EXPORT_C TInt CExtendedDecoder::DoCustomAsync() const
       
    52 	{
       
    53 	CExtendedDecoderPlugin* plugin;
       
    54 	plugin = static_cast<CExtendedDecoderPlugin*>(Plugin());
       
    55 	return plugin->iDoCustomAsync;
       
    56 	}
       
    57 
       
    58 EXPORT_C void CExtendedDecoder::CustomSyncL(TInt aParam)
       
    59 	{
       
    60 	CImageDecoder::CustomSyncL(aParam);
       
    61 	}
       
    62 
       
    63 EXPORT_C void CExtendedDecoder::CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)
       
    64 	{
       
    65 	CImageDecoder::CustomAsync(aRequestStatus, aParam);
       
    66 	}
       
    67 	
       
    68 //CExtendedDecoderPlugin
       
    69 EXPORT_C void CExtendedDecoderPlugin::HandleCustomSyncL(TInt aParam)
       
    70 	{
       
    71 	if(aParam == 0)
       
    72 		iSyncResult = -2;
       
    73 	else
       
    74 		User::Leave(KErrNotSupported);
       
    75 	}
       
    76 
       
    77 EXPORT_C void CExtendedDecoderPlugin::InitCustomAsyncL(TInt aParam)
       
    78 	{
       
    79 	iDoCustomAsync = ETrue;
       
    80 	if(aParam == 0)
       
    81 		{
       
    82 		iAsyncResult = -1;
       
    83 		}
       
    84 	else
       
    85 		{
       
    86 		iDoCustomAsync = EFalse;
       
    87 		User::Leave(KErrNotSupported);
       
    88 		}
       
    89 	}
       
    90 
       
    91 EXPORT_C void CExtendedDecoderPlugin::DoConvert()
       
    92 	{
       
    93 	if(iDoCustomAsync)
       
    94 		{
       
    95 		iAsyncResult = -2;
       
    96 		RequestComplete(KErrNone);
       
    97 		}
       
    98 	else
       
    99 		CImageDecoderPlugin::DoConvert();
       
   100 	}
       
   101 
       
   102 EXPORT_C void CExtendedDecoderPlugin::NotifyComplete()
       
   103 	{
       
   104 	iDoCustomAsync = EFalse;
       
   105 	}
       
   106 
       
   107 EXPORT_C TBool CExtendedDecoderPlugin::UsingThread() const
       
   108 	{
       
   109 	return AmInThread();
       
   110 	}
       
   111 
       
   112 //CExtendedEncoder
       
   113 EXPORT_C CExtendedEncoder* CExtendedEncoder::NewL()
       
   114 	{
       
   115 	CExtendedEncoder* self;
       
   116 	self = new (ELeave) CExtendedEncoder;
       
   117 	return self;
       
   118 	}
       
   119 
       
   120 CExtendedEncoder::CExtendedEncoder()
       
   121 	{
       
   122 	}
       
   123 
       
   124 EXPORT_C TInt CExtendedEncoder::SyncResult() const
       
   125 	{
       
   126 	CExtendedEncoderPlugin* plugin;
       
   127 	plugin = static_cast<CExtendedEncoderPlugin*>(Plugin());
       
   128 	return plugin->iSyncResult;
       
   129 	}
       
   130 
       
   131 EXPORT_C TInt CExtendedEncoder::AsyncResult() const
       
   132 	{
       
   133 	CExtendedEncoderPlugin* plugin;
       
   134 	plugin = static_cast<CExtendedEncoderPlugin*>(Plugin());
       
   135 	return plugin->iAsyncResult;
       
   136 	}
       
   137 
       
   138 EXPORT_C TBool CExtendedEncoder::UsingThread() const
       
   139 	{
       
   140 	CExtendedEncoderPlugin* plugin;
       
   141 	plugin = static_cast<CExtendedEncoderPlugin*>(Plugin());
       
   142 	return plugin->UsingThread();
       
   143 	}
       
   144 
       
   145 EXPORT_C TInt CExtendedEncoder::DoCustomAsync() const
       
   146 	{
       
   147 	CExtendedEncoderPlugin* plugin;
       
   148 	plugin = static_cast<CExtendedEncoderPlugin*>(Plugin());
       
   149 	return plugin->iDoCustomAsync;
       
   150 	}
       
   151 
       
   152 EXPORT_C void CExtendedEncoder::CustomSyncL(TInt aParam)
       
   153 	{
       
   154 	CImageEncoder::CustomSyncL(aParam);
       
   155 	}
       
   156 
       
   157 EXPORT_C void CExtendedEncoder::CustomAsync(TRequestStatus* aRequestStatus, TInt aParam)
       
   158 	{
       
   159 	CImageEncoder::CustomAsync(aRequestStatus, aParam);
       
   160 	}
       
   161 	
       
   162 //CExtendedEncoderPlugin
       
   163 EXPORT_C void CExtendedEncoderPlugin::HandleCustomSyncL(TInt aParam)
       
   164 	{
       
   165 	if(aParam == 0)
       
   166 		iSyncResult = -2;
       
   167 	else
       
   168 		User::Leave(KErrNotSupported);
       
   169 	}
       
   170 
       
   171 EXPORT_C void CExtendedEncoderPlugin::InitCustomAsyncL(TInt aParam)
       
   172 	{
       
   173 	iDoCustomAsync = ETrue;
       
   174 	if(aParam == 0)
       
   175 		{
       
   176 		iAsyncResult = -1;
       
   177 		}
       
   178 	else
       
   179 		{
       
   180 		iDoCustomAsync = EFalse;		
       
   181 		User::Leave(KErrNotSupported);
       
   182 		}
       
   183 	}
       
   184 
       
   185 EXPORT_C void CExtendedEncoderPlugin::DoConvert()
       
   186 	{
       
   187 	if(iDoCustomAsync)
       
   188 		{
       
   189 		iAsyncResult = -2;
       
   190 		RequestComplete(KErrNone);
       
   191 		}
       
   192 	else
       
   193 		CImageEncoderPlugin::DoConvert();
       
   194 	}
       
   195 
       
   196 EXPORT_C void CExtendedEncoderPlugin::NotifyComplete()
       
   197 	{
       
   198 	iDoCustomAsync = EFalse;
       
   199 	}
       
   200 
       
   201 EXPORT_C TBool CExtendedEncoderPlugin::UsingThread() const
       
   202 	{
       
   203 	return AmInThread();
       
   204 	}
       
   205 
       
   206