CImageDecoderPlugin Class Reference

class CImageDecoderPlugin : public CBase

The PluginAPI for Image Converter Library decoder plugins.

Intended for use by plugin writers only.

Inherits from

Public Member Functions
~CImageDecoderPlugin ()
IMPORT_C HBufC * FrameCommentL ( TInt , TInt )
IMPORT_C TInt GetDestinationSize ( TSize &, TInt )
IMPORT_C void GetExtensionL ( TUid , MImageConvExtension *&)
IMPORT_C HBufC * ImageCommentL ( TInt )
void ImageType ( TInt , TUid &, TUid &)
IMPORT_C TInt NumberOfFrameComments ( TInt )
IMPORT_C TInt NumberOfImageComments ()
IMPORT_C void SetClippingRectL (const TRect *)
Protected Member Functions
CImageDecoderPlugin ()
IMPORT_C TBool AmInThread ()
IMPORT_C TInt AppendImageData (const TImageDataBlock *)
IMPORT_C TInt AppendImageDataBuffer (const HBufC8 *)
IMPORT_C void Cleanup ()
IMPORT_C TInt DataLength ()
IMPORT_C CImageDecoder::TOptions DecoderOptions ()
IMPORT_C const CFbsBitmap & Destination ()
IMPORT_C const CFbsBitmap & DestinationMask ()
IMPORT_C void DoConvert ()
IMPORT_C TInt FrameBlockSize ( TInt )
IMPORT_C const CFrameImageData & FrameData ( TInt )
IMPORT_C TInt FrameHeaderBlockSize ( TInt )
IMPORT_C const TFrameInfo & FrameInfo ( TInt )
IMPORT_C CFrameInfoStrings * FrameInfoStringsL ( RFs &, TInt )
IMPORT_C void HandleCustomSyncL ( TInt )
IMPORT_C void HandleProcessFrameResult ( TInt , TFrameState )
IMPORT_C const TImageDataBlock * ImageData ( TInt )
IMPORT_C TInt ImageDataCount ()
IMPORT_C const TFrameInfo & ImageInfo ()
IMPORT_C CImageReadCodec * ImageReadCodec ()
IMPORT_C void InitConvertL ()
IMPORT_C void InitCustomAsyncL ( TInt )
IMPORT_C TInt InsertImageData (const TImageDataBlock *, TInt )
IMPORT_C TBool IsImageHeaderProcessingComplete ()
IMPORT_C void NotifyComplete ()
IMPORT_C TInt NumberOfFrames ()
IMPORT_C void OpenExtraResourceFileLC ( RFs &, const TUid , RResourceFile &)
IMPORT_C TInt Position ()
IMPORT_C void PrepareForProcessFrameL ()
IMPORT_C void ReadDataL ( TInt , TPtrC8 &, TInt )
IMPORT_C void ReadFrameHeadersL ()
IMPORT_C void RemoveImageData ( TInt )
IMPORT_C void RequestComplete ( TInt )
IMPORT_C void RequestInitL ( TInt )
void ScanDataL ()
IMPORT_C void SelfComplete ( TInt )
IMPORT_C void SetDataLength ( TInt )
IMPORT_C void SetImageInfo (const TFrameInfo &)
IMPORT_C void SetImageReadCodec ( CImageReadCodec *)
IMPORT_C void SetPosition (const TInt )
IMPORT_C void SetSelfPending ()
IMPORT_C void SetStartPosition ( TInt )
IMPORT_C void SetThumbnailData ( HBufC8 *)
IMPORT_C TBool ShouldAbort ()
IMPORT_C TBufPtr8 & SourceData ()
IMPORT_C TInt SourceLength ()
IMPORT_C TInt StartPosition ()
IMPORT_C TBool ValidDestination ()
IMPORT_C TBool ValidDestinationMask ()
Private Member Functions
IMPORT_C void EnableMaskGeneration ()
IMPORT_C void NotifyImageTypeChangeL ( TInt )
IMPORT_C void ReservedVirtual1 ()
TBool ValidProperties ()
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 Attributes
CImageDecoderPriv * iProperties

Constructor & Destructor Documentation

CImageDecoderPlugin()

IMPORT_C CImageDecoderPlugin ( ) [protected]

Constructor for this class.

~CImageDecoderPlugin()

IMPORT_C ~CImageDecoderPlugin ( )

Destructor for this class.

Member Functions Documentation

AmInThread()

IMPORT_C TBool AmInThread ( ) const [protected]

Indicates if this decoder is running in a separate thread.

AppendImageData(const TImageDataBlock *)

IMPORT_C TInt AppendImageData ( const TImageDataBlock * aEntry ) [protected]

Appends a new image data data block to the end of the internally held array.

Parameters

const TImageDataBlock * aEntry The image data block to be appended.

AppendImageDataBuffer(const HBufC8 *)

IMPORT_C TInt AppendImageDataBuffer ( const HBufC8 * aImageBuffer ) [protected]

Appends a new image data buffer to the end of the internally held array

Parameters

const HBufC8 * aImageBuffer The data buffer to append.

Cleanup()

IMPORT_C void Cleanup ( ) [protected, virtual]

Called when the plugin is destroyed or a decode is cancelled. This may be overriden in derived classes.

Note: Derived classes must call this version after performing any plugin specific cleanup.

DataLength()

IMPORT_C TInt DataLength ( ) const [protected]

Returns the maximum number of bytes of data that can be decoded.

DecoderOptions()

IMPORT_C CImageDecoder::TOptions DecoderOptions ( ) const [protected]

Returns the decoding options specified by the client when it created the CImageDecoder object.

Destination()

IMPORT_C const CFbsBitmap & Destination ( ) const [protected]

Returns the destination bitmap.

DestinationMask()

IMPORT_C const CFbsBitmap & DestinationMask ( ) const [protected]

Returns the destination bitmap mask.

DoConvert()

IMPORT_C void DoConvert ( ) [protected, virtual]

Performs a decode step. This effectively forms the RunL() call of the decoder.

This call may be overriden in derived classes. However, if this the case, then if the custom decode is not performed and the derived class should either ensure that this base class's version is called or should completely replace the base class's version calling PrepareForProcessFrameL() , ProcessFrameL() and HandleProcessFrameResult() as appropriate. Unlike the standard version, an override instance may choose to spread these calls over several RunL() instances.

EnableMaskGeneration()

IMPORT_C void EnableMaskGeneration ( ) [private, virtual]

Enables generation of an image mask (to be implemented by the plugin if this feature is supported).

FrameBlockSize(TInt)

IMPORT_C TInt FrameBlockSize ( TInt aFrameNumber ) const [protected, virtual]

Returns the block size used in the specified frame. Always returns 4096 regardless of the frame number specified. Should be overriden by codecs that use larger blocks.

Parameters

TInt aFrameNumber The frame to which the block size information applies.

FrameCommentL(TInt, TInt)

IMPORT_C HBufC * FrameCommentL ( TInt aFrameNumber,
TInt aCommentNumber
) const [virtual]

Returns a particular comment attatched to a given frame of the image.

Ownership of the returned buffer is transferred to the caller.

Parameters

TInt aFrameNumber The index of the frame containing the comments.
TInt aCommentNumber The index of the comment to retrieve from the specified frame.

FrameData(TInt)

IMPORT_C const CFrameImageData & FrameData ( TInt aFrameNumber = 0 ) const [protected]

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

Parameters

TInt aFrameNumber = 0 The frame number from which to retreive the frame data (Optional, defaults to 0).

FrameHeaderBlockSize(TInt)

IMPORT_C TInt FrameHeaderBlockSize ( TInt aFrameNumber ) const [protected, virtual]

Returns the block size used in the specified frame's header. Always returns 4096 regardless of the frame number specified. Should be overriden by codecs that use larger blocks.

Parameters

TInt aFrameNumber The frame to which the header block size information applies.

FrameInfo(TInt)

IMPORT_C const TFrameInfo & FrameInfo ( TInt aFrameNumber = 0 ) const [protected]

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 decoding it.

Parameters

TInt aFrameNumber = 0 The frame number for which information is requested (Optional, defaults to 0).

FrameInfoStringsL(RFs &, TInt)

IMPORT_C CFrameInfoStrings * FrameInfoStringsL ( RFs & aFs,
TInt aFrameNumber = 0
) [protected, pure virtual]

Returns the codec specific frame information stored in resource files.

This is a virtual function that each individual plugin must implement.

Parameters

RFs & aFs A handle to a file server session.
TInt aFrameNumber = 0 The frame number to which the codec specific frame information applies (optional, defaults to zero).

GetDestinationSize(TSize &, TInt)

IMPORT_C TInt GetDestinationSize ( TSize & aSize,
TInt aFrameNumber = 0
) [virtual]

Called by framework on plugin to get the size of decoded image.

Get the size of the decoded image for the given frame. The calculation will account for any clipping rectangle set, scaling applied through the TImageConvScaler extension and any operation applied through TImageConvOperation . If TImageConvScaler::SetScalingL (.. has been called then the size of the bitmap passed to CImageDecoder::Convert must match the size returned from this function.

Gets the size of the destination CFbsBitmap needed prior to a call to Convert(). Essential when using the ICL Framework Extensions such as SetClippingRectL() or codec extensions obtained through the OperationL(), ScalerL() and BlockStreamerL() calls.

CImageDecoder::OperationL() CImageDecoder::ScalerL() CImageDecoder::BlockStreamerL() CImageDecoder::SetClippingRectL() CImageDecoder::Convert()

Parameters

TSize & aSize A reference to a TSize that specifies the size of the region that is to be decoded by a call to Convert().
TInt aFrameNumber = 0 The number of the frame that is to be decoded.

GetExtensionL(TUid, MImageConvExtension *&)

IMPORT_C void GetExtensionL ( TUid aExtUid,
MImageConvExtension *& aExtPtr
) [virtual]

Called by the framework to obtain a pointer to a codec implemented extension.

icl_uids.hrh .

Parameters

TUid aExtUid Extension UID normally prefixed KUidImageConv.
MImageConvExtension *& aExtPtr Returns a ptr to the extension implemented by the codec plugin.

HandleCustomSyncL(TInt)

IMPORT_C void HandleCustomSyncL ( TInt aParam ) [protected, virtual]

Called as a result of an associated CImageDecoder::CustomSyncL() function being called. Plugins may override this to provide extended commands in CImageDecoder . Default version leaves with KErrNotSupported.

Parameters

TInt aParam Interpretation dependent on plugin.

HandleProcessFrameResult(TInt, TFrameState)

IMPORT_C void HandleProcessFrameResult ( TInt aErrCode,
TFrameState aCodecState
) [protected]

Deals with result from ProcessFrameL(). This function processes the results of the standard ProcessFrameL() call, feeding in the resultant error code from its TRAP and the status result. It will call RequestComplete() or SelfComplete() as appropriate.

Note that if no data was consumed by ProcessFrameL(), HandleProcessFrameResult() assumes that it requires more data and calls RequestComplete(KErrUnderflow). If this is not appropriate, an overloaded DoConvert() should be made to handle it.

Parameters

TInt aErrCode The error result of TRAP arround ProcessFrameL().
TFrameState aCodecState The result of ProcessFrameL() itself.

ImageCommentL(TInt)

IMPORT_C HBufC * ImageCommentL ( TInt aCommentNumber ) const [virtual]

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

Parameters

TInt aCommentNumber The comment number.

ImageData(TInt)

IMPORT_C const TImageDataBlock * ImageData ( TInt aIndex ) const [protected]

Returns the image data block for the specified index.

Parameters

TInt aIndex The index of the image data block to return.

ImageDataCount()

IMPORT_C TInt ImageDataCount ( ) const [protected]

Returns the number of image data blocks present in the image data.

ImageInfo()

IMPORT_C const TFrameInfo & ImageInfo ( ) const [protected]

Returns image information such as colour depth, scaling support etc.

ImageReadCodec()

IMPORT_C CImageReadCodec * ImageReadCodec ( ) const [protected]

Returns the plugin's read codec.

ImageType(TInt, TUid &, TUid &)

void ImageType ( TInt aFrameNumber,
TUid & aImageType,
TUid & aImageSubType
) const [pure virtual]

Returns the image type and sub-type for a given frame of the image that has just been opened.

This is a virtual function that each individual plugin must implement.

Parameters

TInt aFrameNumber The frame index for type and sub-type information should be returned.
TUid & aImageType On return contains the image type UID for the specified frame.
TUid & aImageSubType On return contains the image sub-type UID for the specified frame. If the sub-type does not exist KNullUid is returned.

InitConvertL()

IMPORT_C void InitConvertL ( ) [protected, virtual]

Initialises data structures prior to decoding a frame.

This function may be overriden in derived classes. Any override should also call this version after performing any plugin initialistion.

InitCustomAsyncL(TInt)

IMPORT_C void InitCustomAsyncL ( TInt aParam ) [protected, virtual]

Called as a result of the associated CImageDecoder::CustomAsync() function being called.

If this function finishes normally, then a convert cycle is started - so that DoConvert() will be subsequently started in the background - otherwise, if this function leaves then the error result is immediately signalled back to the caller of CustomAsync().

Plugins may override this to provide extended commands in CImageDecoder.Users of CImageEncoder can then use the extended encoder functions by calling CustomAsync, rather than CImageEncoder::Convert() .

By default this function leaves with KErrNotSupported unless overriden.

Parameters

TInt aParam Interpretation dependent on plugin.

InsertImageData(const TImageDataBlock *, TInt)

IMPORT_C TInt InsertImageData ( const TImageDataBlock * aEntry,
TInt aPos
) [protected]

Inserts an image data block into the internally held array at the specified position.

Parameters

const TImageDataBlock * aEntry Pointer to the image data block to be inserted.
TInt aPos The position within the arrary to insert the data block.

IsImageHeaderProcessingComplete()

IMPORT_C TBool IsImageHeaderProcessingComplete ( ) const [protected]

Returns the status of header processing. If the processing is incomplete or not terminated correctly EFalse will be returned

NotifyComplete()

IMPORT_C void NotifyComplete ( ) [protected, virtual]

Plugin defined actions resulting from a call by RequestComplete() .

This function is called when a RequestComplete() is issued indicating that an asynchronous command has finished. Plugins can extend this function to, clear any custom command flags.

NotifyImageTypeChangeL(TInt)

IMPORT_C void NotifyImageTypeChangeL ( TInt aImageType ) [private, virtual]

Notify the plugin that the client has changed the requested source image type (e.g. Main to Thumb or vice-versa)

Parameters

TInt aImageType

NumberOfFrameComments(TInt)

IMPORT_C TInt NumberOfFrameComments ( TInt aFrameNumber ) const [virtual]

Returns the number of comments attatched to a given frame of the image.

Use NumberOfImageComments() for the image equivalent.

Parameters

TInt aFrameNumber The frame number.

NumberOfFrames()

IMPORT_C TInt NumberOfFrames ( ) const [protected]

Returns the number of frames to be decoded.

NumberOfImageComments()

IMPORT_C TInt NumberOfImageComments ( ) const [virtual]

Returns the number of comments attatched to the image.

Some image formats allow comments to be attached to the entire image, others allow comments to be attached to individual frames within the image. Use this function to retrieve the number of comments in the image. Use NumberOfFrameComments() for the frame equivalent.

OpenExtraResourceFileLC(RFs &, const TUid, RResourceFile &)

IMPORT_C void OpenExtraResourceFileLC ( RFs & aFs,
const TUid aUid,
RResourceFile & aResourceFile
) const [protected]

Locates the extra resource file for the decoder aUid_extra.rsc, opens the resource file and pushes it on the cleanup stack.

If the resource file is not found the method leaves with KErrNotFound. If more than one resource file is found, only the first one is opened.

Parameters

RFs & aFs A reference to the file server.
const TUid aUid The decoder's UID.
RResourceFile & aResourceFile A reference to the opened resource file.

Position()

IMPORT_C TInt Position ( ) const [protected]

Returns the current position within the data.

PrepareForProcessFrameL()

IMPORT_C void PrepareForProcessFrameL ( ) [protected]

Initialises system for ProcessFrameL(). This reads in a new buffer for ProcessFrameL().

ReadDataL(TInt, TPtrC8 &, TInt)

IMPORT_C void ReadDataL ( TInt aPosition,
TPtrC8 & aReadBuffer,
TInt aLength
) [protected]

Reads a block of data into an internal buffer.

A block of data of size aLength is read from the position specified by aPosition to an internal data buffer. After a successful read, aReadBuffer is set to point to the internal buffer.

If an attempt is made to read past the end of data, all available data is read and the descriptors length will indicate the actual number of bytes read.

Parameters

TInt aPosition The start position from where data will be read.
TPtrC8 & aReadBuffer Upon completion of a successful call, points to the internal buffer containing the data read from the source.
TInt aLength The size in bytes of the block of data to be read.

ReadFrameHeadersL()

IMPORT_C void ReadFrameHeadersL ( ) [protected, virtual]

Invokes the ReadFrameHeadersL method of the supplied plugin which should process the frame headers contained within the image.

RemoveImageData(TInt)

IMPORT_C void RemoveImageData ( TInt aPos ) [protected]

Removes a specified image data block from the internally held array.

Parameters

TInt aPos The index of the image data block to be removed.

RequestComplete(TInt)

IMPORT_C void RequestComplete ( TInt aReason ) [protected]

Must be called on completion of decoding the image data.

CImageDecoderPlugin::SelfComplete(TInt aReason)

Parameters

TInt aReason KErrNone should be returned if the decoding completes successfully. If the request fails an appropriate error code should be returned.

RequestInitL(TInt)

IMPORT_C void RequestInitL ( TInt aFrameNumber ) [protected]

Forces initialization of data structures prior to decoding a frame.

Parameters

TInt aFrameNumber The frame in a multi-frame image to decode.

ReservedVirtual1()

IMPORT_C void ReservedVirtual1 ( ) [private, virtual]

Intended for future proofing - will panic if called.

panic
EReservedCall

ScanDataL()

void ScanDataL ( ) [protected, pure virtual]

Invokes the ReadFrameHeadersL() method of the supplied plugin.

The plugin's version of ReadFrameHeadersL() should read the image header information, create the required codec and read the frame headers.

This is a virtual function that each individual plugin must implement.

SelfComplete(TInt)

IMPORT_C void SelfComplete ( TInt aReason ) [protected]

Must be called at the end of a slice of decoding.

If successful specify KErrNone that results in a repeat call to DoConvert() .

CImageDecoderPlugin::RequestComplete(TInt aReason)

Parameters

TInt aReason The error code giving the reason for completion, or KErrNone if no error occurred.

SetClippingRectL(const TRect *)

IMPORT_C void SetClippingRectL ( const TRect * aClipRect ) [virtual]

Called by the framework on the plugin to apply a clipping rectangle to the image.

Sets the area of interest of the image to be decoded.

leave
KErrNotSupported if clipping is not supported by the codec plugin.
leave
Other system-wide error codes.
Sets the area of interest of the image to be decoded. This function can leave with any of the system-wide error codes.
leave
KErrNotSupported This function is not supported.
leave
KErrArgument Returned if the clipping rectangle: a) is empty (i.e. IsEmpty() returns ETrue) b) is not normalised (i.e. IsNormalized() returns EFalse) c) has coordinates that are not located within, or on, the coodinates of at least one frame of the original image. d) has a width or a height of 0
TRect::IsEmpty() TRect::IsNormalized() TRect::Normalize()

Parameters

const TRect * aClipRect A pointer to a TRect that specifies the location and size of the region to be decoded. This rectangle must have positive width and height values as per TRect::IsNormalized() and TRect::Normalize(). Passing in a NULL value will clear the clipping rectangle.

SetDataLength(TInt)

IMPORT_C void SetDataLength ( TInt aDataLength ) [protected]

Sets the maximum number of bytes of data that can be decoded.

Parameters

TInt aDataLength The maximum number of bytes of data.

SetImageInfo(const TFrameInfo &)

IMPORT_C void SetImageInfo ( const TFrameInfo & aImageInfo ) [protected]

Sets the image information.

Parameters

const TFrameInfo & aImageInfo The image information.

SetImageReadCodec(CImageReadCodec *)

IMPORT_C void SetImageReadCodec ( CImageReadCodec * aImageReadCodec ) [protected]

Sets the plugin's read codec. Ownership of the codec is transferred to the plugin.

Parameters

CImageReadCodec * aImageReadCodec Pointer to the codec.

SetPosition(const TInt)

IMPORT_C void SetPosition ( const TInt aPosition ) [protected]

Sets the current position in the data.

Parameters

const TInt aPosition The current position in the data.

SetSelfPending()

IMPORT_C void SetSelfPending ( ) [protected]

May be called at the start of a slice of decoding if the decoding is expected to complete asynchronously. This sets the AO in CImageDecoderPriv to active, but does not complete the request.

When decoding of the slice is complete, there must be a call to SelfComplete() .

CImageDecoderPlugin::SelfComplete(TInt aReason)

SetStartPosition(TInt)

IMPORT_C void SetStartPosition ( TInt aDataLength ) [protected]

Sets the starting position of the frame to be decoded.

Parameters

TInt aDataLength The starting position in the data.

SetThumbnailData(HBufC8 *)

IMPORT_C void SetThumbnailData ( HBufC8 * aThumbnailData ) [protected]

Passes a pointer to a descriptor containing the thumbnail from the plugin to the framework. The framework then owns this descriptor.

Parameters

HBufC8 * aThumbnailData A pointer to a HBufC8 containing the thumbnail data

ShouldAbort()

IMPORT_C TBool ShouldAbort ( ) const [protected]

Indicates if the decoder should abort early ie. following a call to Cancel().

Note: This function always returns false unless the decoder is running in its own thread.

SourceData()

IMPORT_C TBufPtr8 & SourceData ( ) [protected]

Value to be fed to CImageReadCodec::ProcessFrameL() .

This value is setup by PrepareForProcessFrameL() - it returns the value that will be fed to CImageReadCodec::ProcessFrameL() , and will be used by codecs that fully override DoConvert() .

SourceLength()

IMPORT_C TInt SourceLength ( ) const [protected]

Returns the length of the source data in bytes.

StartPosition()

IMPORT_C TInt StartPosition ( ) const [protected]

Returns the starting position of the frame to be decoded.

ValidDestination()

IMPORT_C TBool ValidDestination ( ) const [protected]

Returns the validity of the destination bitmap.

ValidDestinationMask()

IMPORT_C TBool ValidDestinationMask ( ) const [protected]

Indicates if the destination bitmap mask is valid.

ValidProperties()

TBool ValidProperties ( ) const [private]

Checks that the constructed decoder is valid.

This function is internal and not intended for use.

Member Data Documentation

CImageDecoderPriv * iProperties

CImageDecoderPriv * iProperties [private]