imagingandcamerafws/imagingunittest/testcodec/inc/TestAsyncCodec.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2003-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 __TESTASYNCCODEC_H__
       
    17 #define __TESTASYNCCODEC_H__
       
    18 
       
    19 //#include <bitdev.h>
       
    20 #include <icl/imagecodec.h>
       
    21 
       
    22 #include "TestAsyncConvert.h"
       
    23 
       
    24 class CTestAsyncDecoder;
       
    25 
       
    26 // MTimerObserver
       
    27 // mixin class to handle callbacks from a CUtilityTimer object
       
    28 class MTimerObserver
       
    29 	{
       
    30 public:
       
    31 	virtual void TimerExpired() = 0;
       
    32 	};
       
    33 
       
    34 
       
    35 // CUtilityTimer
       
    36 class CUtilityTimer : public CTimer
       
    37 	{
       
    38 public:
       
    39 	static CUtilityTimer* NewL(TTimeIntervalMicroSeconds32& aDelay, MTimerObserver& aObserver);
       
    40 	~CUtilityTimer();
       
    41 
       
    42 	void InitializeTimer();
       
    43 
       
    44 private:
       
    45     CUtilityTimer(MTimerObserver& aObserver);
       
    46     void ConstructL(TTimeIntervalMicroSeconds32& aDelay);
       
    47 
       
    48 	// from CActive
       
    49     void RunL();
       
    50 	void DoCancel();
       
    51 
       
    52 private:
       
    53     TTimeIntervalMicroSeconds32 iDelay;
       
    54 	MTimerObserver& iObserver;
       
    55     };
       
    56 
       
    57 
       
    58 // Test Read codec.
       
    59 class CTestAsyncReadCodec : public CImageReadCodec, public MTimerObserver
       
    60 	{
       
    61 public:
       
    62 	virtual ~CTestAsyncReadCodec();
       
    63 	static CTestAsyncReadCodec* NewL(CTestAsyncDecoder &aDecoder);
       
    64 	
       
    65 	// From CImageReadCodec
       
    66 	virtual void InitFrameL(TFrameInfo& aFrameInfo, CFrameImageData& aFrameImageData, TBool aDisableErrorDiffusion, CFbsBitmap& aDestination, CFbsBitmap* aDestinationMask);
       
    67 	virtual TFrameState ProcessFrameL(TBufPtr8& aSrc);
       
    68 	virtual TFrameState ProcessFrameHeaderL(TBufPtr8& aData);
       
    69 	virtual void Complete();
       
    70 
       
    71 	// from MTimerObserver
       
    72 	virtual void TimerExpired();
       
    73 
       
    74 private:
       
    75 	CTestAsyncReadCodec(CTestAsyncDecoder &aDecoder);
       
    76 	void ConstructL();
       
    77 
       
    78 private:
       
    79 	CTestAsyncDecoder& iDecoder;
       
    80 	CUtilityTimer* iTimer;
       
    81 	};
       
    82 
       
    83 // Test Write codec.
       
    84 class CTestAsyncWriteCodec : public CImageWriteCodec, public MTimerObserver
       
    85 	{
       
    86 public:
       
    87 	virtual ~CTestAsyncWriteCodec();
       
    88 	static CTestAsyncWriteCodec* NewL(CTestAsyncEncoder &aEncoder);
       
    89 	
       
    90 	// From CImageWriteCodec
       
    91 	virtual void InitFrameL(TBufPtr8& aDst, const CFbsBitmap& aSource);
       
    92 	virtual TFrameState ProcessFrameL(TBufPtr8& aDst);
       
    93 
       
    94 	
       
    95 //	virtual void InitFrameL(TFrameInfo& aFrameInfo, CFrameImageData& aFrameImageData, TBool aDisableErrorDiffusion, CFbsBitmap& aDestination, CFbsBitmap* aDestinationMask);
       
    96 	//virtual TFrameState ProcessFrameL(TBufPtr8& aSrc);
       
    97 	//virtual TFrameState ProcessFrameHeaderL(TBufPtr8& aData);
       
    98 	
       
    99 	void Complete();
       
   100 
       
   101 	// from MTimerObserver
       
   102 	virtual void TimerExpired();
       
   103 
       
   104 private:
       
   105 	CTestAsyncWriteCodec(CTestAsyncEncoder &aEncoder);
       
   106 	void ConstructL();
       
   107 
       
   108 private:
       
   109 	CTestAsyncEncoder& iEncoder;
       
   110 	CUtilityTimer* iTimer;
       
   111 	TBufPtr8* iDst;	// not owned
       
   112 	};
       
   113 
       
   114 #endif
       
   115