mmplugins/imagingplugins/imagedisplay/plugins/mng/MngReadStream.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-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 __MNGREADSTREAM_H__
       
    17 #define __MNGREADSTREAM_H__
       
    18 
       
    19 /** 	@file
       
    20 	@internalTechnology */
       
    21 
       
    22 #include <caf/content.h>
       
    23 
       
    24 #include "InputStream.h"
       
    25 
       
    26 class CMngFileReadStream : protected CBase, public MInputStream
       
    27 	{
       
    28 public:
       
    29 
       
    30 static CMngFileReadStream* NewL(ContentAccess::CData* aCafData);
       
    31 static CMngFileReadStream* NewL(const TDesC8& aData);
       
    32 
       
    33 	virtual TInt DataAvailable();
       
    34 	virtual void WaitForData(TInt aDataNeeded, TRequestStatus& aReq);
       
    35 
       
    36 	virtual void SeekL(TInt aPosition);
       
    37 	virtual TInt Tell();
       
    38 
       
    39 	virtual void Read(TDes8& aBuf, TRequestStatus& aReq, TInt32* aCrc=NULL);
       
    40 	virtual void ReadL(TDes8& aBuf, TInt32* aCrc=NULL);
       
    41 
       
    42 	virtual void ReadInt32L(TInt32& aNumber, TInt32* aCrc=NULL);
       
    43 	virtual void ReadUint16L(TUint16& aNumber, TInt32* aCrc=NULL);
       
    44 	virtual void ReadUint8L(TUint8& aNumber, TInt32* aCrc=NULL);
       
    45 
       
    46 	virtual void ReadInt32L(TInt32* aFirst, TInt aCount, TInt32* aCrc=NULL);
       
    47 	virtual void ReadUint16L(TUint16* aFirst,TInt aCount, TInt32* aCrc=NULL);
       
    48 	virtual void ReadUint8L(TUint8* aFirst, TInt aCount, TInt32* aCrc=NULL);
       
    49 	
       
    50 	virtual void Release();
       
    51 	virtual void AddRef();
       
    52 
       
    53 protected:
       
    54 	inline explicit CMngFileReadStream(ContentAccess::CData* aCafData=NULL);
       
    55 	~CMngFileReadStream();
       
    56 
       
    57 	void ConstructL(const TDesC8& aData);
       
    58 protected:
       
    59 	TPtrC8	iMemBuf;
       
    60 	TInt	iPosition;	// read position within the current buffer i.e. iMemBuf
       
    61 
       
    62 private:
       
    63 	void ConstructL();
       
    64 
       
    65 private:
       
    66 	HBufC8* iOwnedData;
       
    67 	ContentAccess::CData* iCafData;
       
    68 	TInt	iRefCount;
       
    69 	};
       
    70 
       
    71 inline 
       
    72 CMngFileReadStream::CMngFileReadStream(ContentAccess::CData* aCafData):
       
    73 															iCafData(aCafData),iRefCount(1)
       
    74 	{
       
    75 	}
       
    76 	
       
    77 	
       
    78 /**
       
    79 	Implementation of MInputStream interface for MNG player that
       
    80 	provides with adaptation over the ICL framework data reading 
       
    81 	interface
       
    82 */
       
    83 class CMngIclReadStream: public CMngFileReadStream 
       
    84 	{
       
    85 public:
       
    86 	static CMngIclReadStream* NewL(MDataFeed& aDataSupplier);
       
    87 
       
    88 	virtual void WaitForData(TInt aDataNeeded, TRequestStatus& aReq);
       
    89 	virtual void SeekL(TInt aPosition);
       
    90 	virtual TInt Tell();
       
    91 
       
    92 	void InvalidateBuffer();
       
    93 	void RestartL();
       
    94 	void Reset();
       
    95 
       
    96 protected:
       
    97 	inline explicit CMngIclReadStream(MDataFeed& aDataSupplier);
       
    98 
       
    99 private:
       
   100 	void ConstructL();
       
   101 
       
   102 private:
       
   103 	MDataFeed&	iDataSupplier;
       
   104 	TInt		iOverallPosition;	// offset of the data held in the iMemBuf within the image data
       
   105 	};
       
   106 
       
   107 inline 
       
   108 CMngIclReadStream::CMngIclReadStream(MDataFeed& aDataSupplier):
       
   109 													CMngFileReadStream(NULL),iDataSupplier(aDataSupplier)
       
   110 	{
       
   111 	}
       
   112 
       
   113 #endif // ndef __MNGREADSTREAM_H__