CBufferedImageDecoder Class Reference

class CBufferedImageDecoder : public CBase

Buffered image conversion library.

Provides a wrapper arround CImageDecoder that enables you to decode multiple images without having to recreate the CBufferedImageDecoder object each time. One of the key features of this class is the ability to append image data to the decoder object as it becomes available; this is done using AppendDataL().

Inherits from

  • CBufferedImageDecoder
Public Member Functions
~CBufferedImageDecoder()
IMPORT_C voidAppendDataL(const TDesC8 &)
IMPORT_C voidCancel()
IMPORT_C voidContinueConvert(TRequestStatus *)
IMPORT_C voidContinueOpenL()
IMPORT_C voidContinueProcessingHeaderL()
IMPORT_C voidConvert(TRequestStatus *, CFbsBitmap &, TInt)
IMPORT_C voidConvert(TRequestStatus *, CFbsBitmap &, CFbsBitmap &, TInt)
IMPORT_C HBufC *FrameCommentL(TInt, TInt)
IMPORT_C TIntFrameCount()
IMPORT_C const CFrameImageData &FrameData(TInt)
IMPORT_C const TFrameInfo &FrameInfo(TInt)
IMPORT_C CFrameInfoStrings *FrameInfoStringsL(TInt)
IMPORT_C CFrameInfoStrings *FrameInfoStringsLC(TInt)
IMPORT_C HBufC *ImageCommentL(TInt)
IMPORT_C TUidImplementationUid()
IMPORT_C TBoolIsImageHeaderProcessingComplete()
IMPORT_C CBufferedImageDecoder *NewL(RFs &)
IMPORT_C TIntNumberOfFrameComments(TInt)
IMPORT_C TIntNumberOfImageComments()
IMPORT_C voidOpenL(const TDesC8 &, const TDesC8 &, const CImageDecoder::TOptions)
IMPORT_C voidOpenL(const TDesC8 &, const CImageDecoder::TOptions, const TUid, const TUid, const TUid)
IMPORT_C voidReset()
IMPORT_C TBoolValidDecoder()
Private Member Functions
CBufferedImageDecoder(RFs &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enumTState { EStateCreated, EStateOpening, EStateOpen, EStateConverting }
Private Attributes
TPtr8 iBuffer
CImageDecoder *iDecoder
TUid iDecoderUid
RFs iFileSession
TUid iImageSubType
TUid iImageType
TBool iImageTypeOpen
TPtr8 iMimeType
CImageDecoder::TOptions iOptions
TState iState

Constructor & Destructor Documentation

CBufferedImageDecoder(RFs &)

CBufferedImageDecoder(RFs &aFs)[private]

Constructor for this class.

Parameters

RFs & aFs

~CBufferedImageDecoder()

IMPORT_C~CBufferedImageDecoder()[virtual]

Destructor for this class.

Stops decoding if it is in progress and frees all resources owned by the object prior to its destruction.

Member Functions Documentation

AppendDataL(const TDesC8 &)

IMPORT_C voidAppendDataL(const TDesC8 &aData)

Adds new image data.

A copy of the data is held internally, and the caller does not need to retain the data.

Parameters

const TDesC8 & aDataThe new image data to append.

Cancel()

IMPORT_C voidCancel()

Requests an asynchronous decode to terminate.

Cancels any conversions currently in progress.

ContinueConvert(TRequestStatus *)

IMPORT_C voidContinueConvert(TRequestStatus *aRequestStatus)

Continues decoding a frame and/or mask after new image data was added to the source file or descriptor and a previous call to Convert() or ContinueConvert() returned KErrUnderflow.

Parameters

TRequestStatus * aRequestStatusThe request status. On completion contains an error code. KErrNone if frame was decoded successfully, KErrUnderflow if the frame was partially decoded otherwise another of the system-wide error codes.

ContinueOpenL()

IMPORT_C voidContinueOpenL()

Call this function to retry to create a decoder after OpenL() returned with KErrUnderFlow and extra data was added to the descriptor using AppendDataL(). This function can be recalled until ValidDecoder() return ETrue.

leave
KErrUnderflow Not enough data in descriptor to identify which plugin decoder to use.

ContinueProcessingHeaderL()

IMPORT_C voidContinueProcessingHeaderL()

Continues processing image headers after new image data was appended.

This function can be called until IsImageHeaderProcessingComplete() return ETrue.

Convert(TRequestStatus *, CFbsBitmap &, TInt)

IMPORT_C voidConvert(TRequestStatus *aRequestStatus,
CFbsBitmap &aDestination,
TIntaFrameNumber = 0
)

Starts decoding an image frame asynchronously.

When converting the operation can complete with KErrUnderflow, if there is insufficient information in the descriptor. In this situation, ContinueConvert() should be called repeatedly until the descriptor has accumulated enough information for ContinueConvert() to complete with KErrNone.

Parameters

TRequestStatus * aRequestStatusThe request status. On completion contains an error code. KErrNone if frame was decoded successfully, KErrUnderflow if the frame was partially decoded otherwise another of the system-wide error codes.
CFbsBitmap & aDestinationA bitmap that will contain the decoded frame. The bitmap must be created before the call and must be large enough for the frame and set to the required display mode. FrameInfo() can be used to obtain the size and display mode of the frame.
TInt aFrameNumber = 0The frame in multi-frame image to decode (optional).

Convert(TRequestStatus *, CFbsBitmap &, CFbsBitmap &, TInt)

IMPORT_C voidConvert(TRequestStatus *aRequestStatus,
CFbsBitmap &aDestination,
CFbsBitmap &aDestinationMask,
TIntaFrameNumber = 0
)

Starts decoding an image frame and mask asynchronously.

When converting the operation can complete with KErrUnderflow, if there is insufficient information in the descriptor. In this situation, ContinueConvert() should be called repeatedly until the descriptor has accumulated enough information for ContinueConvert() to complete with KErrNone.

Parameters

TRequestStatus * aRequestStatusThe request status. On completion contains an error code. KErrNone if frame was decoded successfully, KErrUnderflow if the frame was partially decoded otherwise another of the system-wide error codes.
CFbsBitmap & aDestinationA bitmap that will contain the decoded frame. The bitmap must be created before the call and must be large enough for the frame and set to the required display mode. FrameInfo() can be used to obtain the size and display mode of the frame.
CFbsBitmap & aDestinationMaskA bitmap that will contain the decoded frame mask. The bitmap must be created before the call and must be large enough for the mask. The display mode must be EGray2 or EGray256 and must be EGray256 if the image contains alpha-blending information. This information can be obtained from the iFlags property and TFrameInfoFlags of TFrameInfo obtained from a FrameInfo() call.
TInt aFrameNumber = 0The frame in multi-frame image to decode (optional).

FrameCommentL(TInt, TInt)

IMPORT_C HBufC *FrameCommentL(TIntaFrameNumber,
TIntaCommentNumber
)const

Returns a particular comment attached to a given frame of the image. Ownership of the returned buffer is transferred to the caller.

Parameters

TInt aFrameNumberThe frame number.
TInt aCommentNumberThe comment number.

FrameCount()

IMPORT_C TIntFrameCount()const

Returns the number of frames in the image being decoded. This function can be called immediately after the call to create the decoder, thus enabling the caller to know how many frames need to be converted.

FrameData(TInt)

IMPORT_C const CFrameImageData &FrameData(TIntaFrameNumber = 0)const

Returns the image data for a specific frame.

Use FrameCount() to determine how many frames are contained in the image before using this function.

Parameters

TInt aFrameNumber = 0The frame number for which to return frame data.

FrameInfo(TInt)

IMPORT_C const TFrameInfo &FrameInfo(TIntaFrameNumber = 0)const

Returns the frame info for a specified frame of the image.

This function can be called immediately after the call to create the decoder, thus enabling the caller to know about each frame in advance of converting it.

Parameters

TInt aFrameNumber = 0The frame number.

FrameInfoStringsL(TInt)

IMPORT_C CFrameInfoStrings *FrameInfoStringsL(TIntaFrameNumber = 0)

Returns the formatted frame information strings for a specific frame.

Ownership is transferred to the caller.

Parameters

TInt aFrameNumber = 0The frame number.

FrameInfoStringsLC(TInt)

IMPORT_C CFrameInfoStrings *FrameInfoStringsLC(TIntaFrameNumber = 0)

Returns the formatted frame information strings for a specific frame and leave it on the cleanup stack.

Ownership is transferred to the caller.

Parameters

TInt aFrameNumber = 0The frame number.

ImageCommentL(TInt)

IMPORT_C HBufC *ImageCommentL(TIntaCommentNumber)const

Returns a particular comment attached to the image. Ownership of the returned buffer is transferred to the caller.

Use NumberOfImageComments() to determine how many (if any) comments are contained within the image.

Parameters

TInt aCommentNumberThe comment number.

ImplementationUid()

IMPORT_C TUidImplementationUid()const

Returns the implementation UID of the decoder being used to decode the image.

IsImageHeaderProcessingComplete()

IMPORT_C TBoolIsImageHeaderProcessingComplete()const

Returns the status of the image.

If the image is incomplete or not terminated correctly EFalse will be returned

NewL(RFs &)

IMPORT_C CBufferedImageDecoder *NewL(RFs &aFs)[static]

Creates a buffered decoder.

The function leaves if the decoder object cannot be created or initialised.

Parameters

RFs & aFsA reference to a file server session for the decoder to use.

NumberOfFrameComments(TInt)

IMPORT_C TIntNumberOfFrameComments(TIntaFrameNumber)const

Returns the number of comments attached to a given frame of the image as opposed to the whole image.

Use FrameCount() to retrieve the number of frames in the image to ensure that the value you use for aFrameNumber is valid.

Parameters

TInt aFrameNumberThe frame number.

NumberOfImageComments()

IMPORT_C TIntNumberOfImageComments()const

Returns the number of comments attached to the image (as opposed to a particular frame).

OpenL(const TDesC8 &, const TDesC8 &, const CImageDecoder::TOptions)

IMPORT_C voidOpenL(const TDesC8 &aSourceData,
const TDesC8 &aMIMEType,
const CImageDecoder::TOptionsaOptions = CImageDecoder::EOptionNone
)

Creates a decoder for the image in the source buffer. The client supplies a MIME type which will be used to try and select an appropriate plugin decoder. If it finds a decoder it creates it and then goes on to use that decoder to scan the beginning of the image file.

leave
KEComErrNoInterfaceIdentified No plugin decoder could be found for the specified image.

Parameters

const TDesC8 & aSourceDataThe buffer containing the image to be decoded.
const TDesC8 & aMIMETypeThe MIME type of the image in the buffer.
const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNoneThe options to use.

OpenL(const TDesC8 &, const CImageDecoder::TOptions, const TUid, const TUid, const TUid)

IMPORT_C voidOpenL(const TDesC8 &aSourceData,
const CImageDecoder::TOptionsaOptions = CImageDecoder::EOptionNone,
const TUidaImageType = KNullUid,
const TUidaImageSubType = KNullUid,
const TUidaDecoderUid = KNullUid
)

Creates a decoder for the image in the source buffer.

If the client supplies an image type (and sub-type, if applicable) or decoder uid, these will be used to try and select an appropriate plugin decoder. If not, then the selection will be done by matching the image header from the buffer. If it finds a decoder it creates it and then goes on to use that decoder to scan the beginning of the image buffer. If a decoder could not be created append data using AppendDataL() and call ContinueOpenL().

KUidICLJpegEXIFInterface KUidICLJpegImageFrameInterface
leave
KErrUnderflow Not enough data in descriptor to identify which plugin decoder to use.
leave
KEComErrNoInterfaceIdentified No plugin decoder could be found for the specified image.
leave
KErrNotFound The specified codec could not be found.

Parameters

const TDesC8 & aSourceDataThe buffer containing the image to be decoded.
const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNoneThe decoder options to use.
const TUid aImageType = KNullUidThe image type of the image in the file (optional).
const TUid aImageSubType = KNullUidThe image sub-type of the image in the file (optional).
const TUid aDecoderUid = KNullUidThe implementation UID for a specific codec or a decoder/encoder class UID (optional, defaults to KNullUid). If this option is selected for a specific codec the image type and image sub type for the displayer must be supplied. When loading plugins by class UID the image type and image subtype are not mandatory and the first valid plugin from the list of available plugins with the specified class UID will be loaded.

Reset()

IMPORT_C voidReset()

Reset the decoder for reuse.

Follow this call with OpenL() and new source data.

ValidDecoder()

IMPORT_C TBoolValidDecoder()const

Determine if enough data was available to determine which plugin decoder to use. If this return EFalse append extra data using AppendDataL() and and call ContinueOpenL()

Member Enumerations Documentation

Enum TState

Enumerators

EStateCreated
EStateOpening
EStateOpen
EStateConverting

Member Data Documentation

TPtr8 iBuffer

TPtr8 iBuffer[private]

CImageDecoder * iDecoder

CImageDecoder *iDecoder[private]

TUid iDecoderUid

TUid iDecoderUid[private]

RFs iFileSession

RFs iFileSession[private]

TUid iImageSubType

TUid iImageSubType[private]

TUid iImageType

TUid iImageType[private]

TBool iImageTypeOpen

TBool iImageTypeOpen[private]

TPtr8 iMimeType

TPtr8 iMimeType[private]

CImageDecoder::TOptions iOptions

CImageDecoder::TOptions iOptions[private]

TState iState

TState iState[private]