CImageEncoderPlugin Class Reference

class CImageEncoderPlugin : public CBase

The plugin API for Image Converter Library encoder plugins.

Intended for use by plugin writers only.

Inherits from

Public Member Functions
~CImageEncoderPlugin()
IMPORT_C voidGetExtensionL(TUid, MImageConvExtension *&)
Protected Member Functions
CImageEncoderPlugin()
IMPORT_C TBoolAmInThread()
IMPORT_C voidCleanup()
IMPORT_C TIntCurrentImageSizeL()
IMPORT_C TBufPtr8 &DestinationData()
IMPORT_C voidDoConvert()
IMPORT_C CImageEncoder::TOptionsEncoderOptions()
IMPORT_C voidFinishConvertL()
IMPORT_C const TSize &FrameInfoOverallSizeInPixels()
IMPORT_C voidHandleCustomSyncL(TInt)
IMPORT_C voidHandleProcessFrameResult(TInt, TFrameState)
IMPORT_C CImageWriteCodec *ImageWriteCodec()
IMPORT_C voidInitConvertL()
IMPORT_C voidInitCustomAsyncL(TInt)
IMPORT_C voidNotifyComplete()
IMPORT_C TInt &Position()
voidPrepareEncoderL(const CFrameImageData *)
IMPORT_C voidRequestComplete(TInt)
IMPORT_C voidRequestInitL()
IMPORT_C voidSelfComplete(TInt)
IMPORT_C voidSetImageWriteCodec(CImageWriteCodec *)
IMPORT_C voidSetSelfPending()
IMPORT_C TBoolShouldAbort()
IMPORT_C const CFbsBitmap &Source()
IMPORT_C TInt &StartPosition()
voidUpdateHeaderL()
IMPORT_C TBoolValidSource()
IMPORT_C voidWriteDataL(TInt, const TDesC8 &)
IMPORT_C voidWriteDataPositionIncL(TInt, const TDesC8 &)
Private Member Functions
IMPORT_C voidReservedVirtual1()
IMPORT_C voidReservedVirtual2()
IMPORT_C voidReservedVirtual3()
IMPORT_C voidSetThumbnail(TBool)
TBool ValidProperties()
IMPORT_C voidWriteExifDataL(TRequestStatus *&)
IMPORT_C voidWriteThumbnailL()
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
CImageEncoderPriv *iProperties

Constructor & Destructor Documentation

CImageEncoderPlugin()

IMPORT_CCImageEncoderPlugin()[protected]

Constructor for this class.

~CImageEncoderPlugin()

IMPORT_C~CImageEncoderPlugin()

Destructor for this class.

Member Functions Documentation

AmInThread()

IMPORT_C TBoolAmInThread()const [protected]

Indicates if this encoder is running in a separate thread.

Cleanup()

IMPORT_C voidCleanup()[protected, virtual]

Called when the plugin is destroyed or an encode is cancelled to perform cleanup functions.

This function may be overriden in derived classes in which case the derived class should ensure it calls this version after performing any plugin specific cleanup.

CurrentImageSizeL()

IMPORT_C TIntCurrentImageSizeL()const [protected]

Returns the current size of the encoded image in bytes.

DestinationData()

IMPORT_C TBufPtr8 &DestinationData()[protected]

Returns the value to be fed to CImageWriteCodec::ProcessFrameL(), and will be used by codecs that fully override DoConvert().

DoConvert()

IMPORT_C voidDoConvert()[protected, virtual]

Performs the encoding process.

This call may be overriden in derived classes. If this is not the case and a custom decode is not performed, the derived class should ensure that this base class's version is called.

EncoderOptions()

IMPORT_C CImageEncoder::TOptionsEncoderOptions()const [protected]

Enables getting set of options which has been passed by client during encoder object creation. Plugins should ignore unknown options.

FinishConvertL()

IMPORT_C voidFinishConvertL()[protected]

Notifies the framework that the main frame encoding is complete, so it can tidy up. This results in a call to UpdateHeaderL() and then either the descriptor is copied across or the file is closed.

Note: This function is only used if a decoder replaces the DoConvert() call - the default version does this as part of its processing.

FrameInfoOverallSizeInPixels()

IMPORT_C const TSize &FrameInfoOverallSizeInPixels()const [protected]

Returns the overall size of the image frame in pixels.

GetExtensionL(TUid, MImageConvExtension *&)

IMPORT_C voidGetExtensionL(TUidaExtUid,
MImageConvExtension *&aExtPtr
)[virtual]

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

icl_uids.hrh .

Parameters

TUid aExtUidExtension UID normally prefixed KUidImageConv.
MImageConvExtension *& aExtPtr

HandleCustomSyncL(TInt)

IMPORT_C voidHandleCustomSyncL(TIntaParam)[protected, virtual]

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

Parameters

TInt aParamInterpretation dependent on plugin.

HandleProcessFrameResult(TInt, TFrameState)

IMPORT_C voidHandleProcessFrameResult(TIntaErrCode,
TFrameStateaCodecState
)[protected]

Deals with the result from ProcessFrameL().

This 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 created by ProcessFrameL(), HandleProcessFrameResult() assumes that the encoding process is complete. If this is not appropriate, an overloaded DoConvert() should be used to handle it.

Parameters

TInt aErrCodeThe error result of TRAP around ProcessFrameL().
TFrameState aCodecStateThe result of ProcessFrameL() itself.

ImageWriteCodec()

IMPORT_C CImageWriteCodec *ImageWriteCodec()const [protected]

Returns the plugin's write codec.

InitConvertL()

IMPORT_C voidInitConvertL()[protected, virtual]

Initialises data structures prior to encoding a frame.

This may be overriden in derived classes in which case the derived class should ensure it calls this version after performing any plugin initialisation.

InitCustomAsyncL(TInt)

IMPORT_C voidInitCustomAsyncL(TIntaParam)[protected, virtual]

Called as a result of the associated CImageEncoder::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().

The default version leaves with KErrNotSupported unless overridden to change this behaviour. Plugins may override this to provide extended commands in CImageEncoder.

Parameters

TInt aParamInterpretation dependent on plugin.

NotifyComplete()

IMPORT_C voidNotifyComplete()[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.

Position()

IMPORT_C TInt &Position()const [protected]

Returns the current position within the internal data buffer that is being written to.

WriteDataPositionIncL(TInt aPosition,const TDesC8& aDes) WriteDataL(TInt aPosition,const TDesC8& aDes)

PrepareEncoderL(const CFrameImageData *)

voidPrepareEncoderL(const CFrameImageData *aFrameImageData)[protected, pure virtual]

Allocates the specific codec used for the encoding and passes ownership to the plugin.

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

Parameters

const CFrameImageData * aFrameImageDataThe parameters which can be passed on to the encoding algorithm. This data might be used to determine the exact codec created.

RequestComplete(TInt)

IMPORT_C voidRequestComplete(TIntaReason)[protected]

This function must be called on completion of encoding the image data.

CImageEncoderPlugin::SelfComplete(TInt aReason)

Parameters

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

RequestInitL()

IMPORT_C voidRequestInitL()[protected]

Forces initialization of data structures prior to decoding a frame.

ReservedVirtual1()

IMPORT_C voidReservedVirtual1()[private, virtual]

Intended for future proofing - will panic if called.

panic
EReservedCall

ReservedVirtual2()

IMPORT_C voidReservedVirtual2()[private, virtual]

Intended for future proofing - will panic if called.

panic
EReservedCall

ReservedVirtual3()

IMPORT_C voidReservedVirtual3()[private, virtual]

Intended for future proofing - will panic if called.

panic
EReservedCall

SelfComplete(TInt)

IMPORT_C voidSelfComplete(TIntaReason)[protected]

Must be called at the end of a slice of encoding. If called with KErrNone will cause a repeat call to DoConvert().

CImageEncoderPlugin::RequestComplete(TInt aReason)

Parameters

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

SetImageWriteCodec(CImageWriteCodec *)

IMPORT_C voidSetImageWriteCodec(CImageWriteCodec *aImageWriteCodec)const [protected]

Sets the plugin's write codec.

Ownership of the codec is transferred to the plugin.

Parameters

CImageWriteCodec * aImageWriteCodecA pointer to the codec.

SetSelfPending()

IMPORT_C voidSetSelfPending()[protected]

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

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

CImageEncoderPlugin::SelfComplete(TInt aReason)

SetThumbnail(TBool)

IMPORT_C voidSetThumbnail(TBoolaDoGenerateThumbnail)[private, virtual]

Tells the encoder to generate the thumbnail

THis is used only for Exif format. If aDoGenerateThumbnail=EFalse, the thumbnail is not generated. The default value is ETrue

Parameters

TBool aDoGenerateThumbnail

ShouldAbort()

IMPORT_C TBoolShouldAbort()const [protected]

Indicates if an encode should abort early (ie. following a Cancel).

Note: This function always returns EFalse unless the encoder is running in its own thread.

Source()

IMPORT_C const CFbsBitmap &Source()const [protected]

Returns the bitmap which is being encoded.

StartPosition()

IMPORT_C TInt &StartPosition()const [protected]

Returns the starting position of the internal data buffer of the encoded image that is being written to.

UpdateHeaderL()

voidUpdateHeaderL()[protected, pure virtual]

May be used to fill in additional fields at the end of the encoding process, which it may not have been possible to do earlier.

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

ValidProperties()

TBool ValidProperties()const [private]

Checks that the constructed encoder is valid.

ValidSource()

IMPORT_C TBoolValidSource()const [protected]

Checks the validity of the bitmap which is being encoded. Returns ETrue if the bitmap is valid, otherwise EFalse.

WriteDataL(TInt, const TDesC8 &)

IMPORT_C voidWriteDataL(TIntaPosition,
const TDesC8 &aDes
)[protected]

Writes a descriptor to the internal data buffer of the encoded image without incrementing the position in the buffer, and therefore a call to Position() will return the same value before or after a call to this function.

Position()

Parameters

TInt aPositionThe start position in the internal data buffer of the encoded image from which point the data in aDes is written.
const TDesC8 & aDesThe descriptor containing the data to be written to the internal data buffer of the encoded image.

WriteDataPositionIncL(TInt, const TDesC8 &)

IMPORT_C voidWriteDataPositionIncL(TIntaPosition,
const TDesC8 &aDes
)[protected]

Writes a descriptor to the internal data buffer of the encoded image. In addition, the position in the buffer that is written to (obtained with Position()) will be incremented returning aPosition + aDes.Length().

Position()

Parameters

TInt aPositionThe start position in the internal data buffer of the encoded image from which point the data in aDes is written.
const TDesC8 & aDesThe descriptor containing the data to be written to the internal data buffer of the encoded image.

WriteExifDataL(TRequestStatus *&)

IMPORT_C voidWriteExifDataL(TRequestStatus *&aScaleCompletionStatus)[private, virtual]

Originally only used by the jpeg codec, but now in use as a generic pre-convert async step

Intended for future proofing - will panic if called

panic
EReservedCall

Parameters

TRequestStatus *& aScaleCompletionStatus

WriteThumbnailL()

IMPORT_C voidWriteThumbnailL()[private, virtual]

Sets the thumbnail in the encoded file

panic
EReservedCall

Member Data Documentation

CImageEncoderPriv * iProperties

CImageEncoderPriv *iProperties[private]