mmplugins/imagingplugins/imagedisplay/plugins/mng/MngReadCodec.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2005-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 /**
       
    17  @file
       
    18  @internalTechnology 
       
    19 */
       
    20 
       
    21 #ifndef MNGREADCODEC_H
       
    22 
       
    23 #define MNGREADCODEC_H
       
    24 
       
    25 #include "MngPlayerObserver.h"
       
    26 
       
    27 class CMngPlayer;
       
    28 class CMngFileReadStream;
       
    29 
       
    30 /**
       
    31 	Observer for codec, allows codec to notify a client about 
       
    32 	particular codec event such as frame readiness, decode completion etc.
       
    33 */
       
    34 class MMngCodecObserver
       
    35 	{
       
    36 public:
       
    37 	enum TCodecEvent 
       
    38 		{
       
    39 		KDataParseCompleted,		// 0
       
    40 		KFrameReady,				// 1
       
    41 		KDecodeCompleted=0xFFFF,	// 0xFFFF
       
    42 		};
       
    43 public:
       
    44 	virtual void OnCodecEvent(TCodecEvent aEventCode, TInt aErrorCode)=0;
       
    45 	};
       
    46 	
       
    47 /**
       
    48 	Implementation of read codec for MNG-LC format, re-uses 
       
    49 	format "player" implementation of Image Display one
       
    50 */
       
    51 class CMngReadCodec:	public CImageMaskProcessorReadCodec,
       
    52 						protected MMngPlayerObserver
       
    53 	{
       
    54 public:
       
    55 
       
    56 	static CMngReadCodec * NewL(CMngFileReadStream& aMngReadStream, MMngCodecObserver& aObserver, TBool aMngSubframesNoLoops);  //Subframes with No Loops
       
    57 	~CMngReadCodec();
       
    58 
       
    59 	void Restart();
       
    60 	void DecodeL();
       
    61 	void StopDecode();
       
    62 
       
    63 	inline TUint ImageFeatures() const;
       
    64 
       
    65 // from the CImageReadCodec
       
    66 	virtual void InitFrameL(TFrameInfo& aFrameInfo, CFrameImageData& aFrameImageData, TBool aDisableErrorDiffusion, CFbsBitmap& aDestination, CFbsBitmap* aDestinationMask);
       
    67 	virtual TFrameState ProcessFrameL(TBufPtr8& aSrc);
       
    68 	virtual void InitFrameHeader(TFrameInfo& aFrameSettings, CFrameImageData& /* aFrameImageData */);
       
    69 	virtual TInt ReducedSize(const TSize& aOriginalSize, TInt aReductionFactor, TSize& aReducedSize) const;
       
    70 protected:
       
    71 	inline CMngReadCodec(MMngCodecObserver& aObserver, TBool aMngSubframesNoLoops);   //Subframes with No Loops
       
    72 	void ConstructL(CMngFileReadStream& aMngReadStream);
       
    73 	TInt GetBitmaps();
       
    74 	void SendFrameUpdate(TInt aError);
       
    75 	void CreatePlayerL();
       
    76 // from the MMngPlayerObserver // 
       
    77 	virtual void OnDecodeEvent(TUint aEventFlags, TInt aErrorCode);
       
    78 
       
    79 private:
       
    80 	TBool iMngSubframesNoLoops;   //Subframes with No Loops
       
    81 	MMngCodecObserver&	iObserver;
       
    82 	TFrameInfo*			iFrameInfo;		// not owned
       
    83 	CFbsBitmap*			iCurrentFrame;	// not owned
       
    84 	CFbsBitmap*			iCurrentMask;	// not owned
       
    85 	CMngPlayer*			iMngPlayer;
       
    86 	CMngFileReadStream* iMngReadStream;
       
    87 	TTimeIntervalMicroSeconds32 iFrameDelay;
       
    88 	TUint						iFrameStatus;
       
    89 	TInt						iFrameNumber;
       
    90 	TUint						iImageFeatures;
       
    91 	TRect         				iFrameRect;
       
    92 	};
       
    93 
       
    94 inline 
       
    95 CMngReadCodec::CMngReadCodec(MMngCodecObserver& aObserver, TBool aMngSubframesNoLoops):iMngSubframesNoLoops(aMngSubframesNoLoops),  //Subframes with No Loops
       
    96 																			  iObserver(aObserver)  //Subframes with No Loops
       
    97 	{
       
    98 	}
       
    99 
       
   100 inline 
       
   101 TUint CMngReadCodec::ImageFeatures() const
       
   102 	{
       
   103 	return iImageFeatures;
       
   104 	}
       
   105 
       
   106 #endif // ndef MNGREADCODEC_H
       
   107 
       
   108