Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: ImagePlugin.h
Link against: imageconversion.lib

Class CImageEncoderPlugin

class CImageEncoderPlugin : public CBase;

Description

The plugin API for Image Converter Library encoder plugins.

Intended for use by plugin writers only.

Derivation

Members

Defined in CImageEncoderPlugin:
AmInThread(), CImageEncoderPlugin(), Cleanup(), CurrentImageSizeL(), DestinationData(), DoConvert(), FinishConvertL(), FrameInfoOverallSizeInPixels(), HandleCustomSyncL(), HandleProcessFrameResult(), ImageWriteCodec(), InitConvertL(), InitCustomAsyncL(), NotifyComplete(), Position(), PrepareEncoderL(), RequestComplete(), RequestInitL(), SelfComplete(), SetImageWriteCodec(), SetSelfPending(), ShouldAbort(), Source(), StartPosition(), UpdateHeaderL(), ValidSource(), WriteDataL(), WriteDataPositionIncL(), WriteExifDataL(), ~CImageEncoderPlugin()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


~CImageEncoderPlugin()

IMPORT_C ~CImageEncoderPlugin();

Description

Destructor for this class.


CImageEncoderPlugin()

protected: IMPORT_C CImageEncoderPlugin();

Description

Constructor for this class.

[Top]


Member functions


Cleanup()

protected: virtual IMPORT_C void Cleanup();

Description

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.


InitConvertL()

protected: virtual IMPORT_C void InitConvertL();

Description

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.


RequestInitL()

protected: IMPORT_C void RequestInitL();

Description

Forces initialization of data structures prior to decoding a frame.


DoConvert()

protected: virtual IMPORT_C void DoConvert();

Description

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.


HandleProcessFrameResult()

protected: IMPORT_C void HandleProcessFrameResult(TInt aErrCode, TFrameState aCodecState);

Description

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 aErrCode

The error result of TRAP around ProcessFrameL().

TFrameState aCodecState

The result of ProcessFrameL() itself.


DestinationData()

protected: IMPORT_C TBufPtr8 &DestinationData();

Description

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

Return value

TBufPtr8 &


FinishConvertL()

protected: IMPORT_C void FinishConvertL();

Description

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.


WriteDataL()

protected: IMPORT_C void WriteDataL(TInt aPosition, const TDesC8 &aDes);

Description

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.

Parameters

TInt aPosition

The start position in the internal data buffer of the encoded image from which point the data in aDes is written.

const TDesC8 &aDes

The descriptor containing the data to be written to the internal data buffer of the encoded image.

See also:


WriteDataPositionIncL()

protected: IMPORT_C void WriteDataPositionIncL(TInt aPosition, const TDesC8 &aDes);

Description

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().

Parameters

TInt aPosition

The start position in the internal data buffer of the encoded image from which point the data in aDes is written.

const TDesC8 &aDes

The descriptor containing the data to be written to the internal data buffer of the encoded image.

See also:


Source()

protected: IMPORT_C const CFbsBitmap &Source() const;

Description

Returns the bitmap which is being encoded.

Return value

const CFbsBitmap &

A reference to the source bitmap.


ValidSource()

protected: IMPORT_C TBool ValidSource() const;

Description

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

Return value

TBool

A boolean describing the validity of the bitamp.


ImageWriteCodec()

protected: IMPORT_C CImageWriteCodec *ImageWriteCodec() const;

Description

Returns the plugin's write codec.

Return value

CImageWriteCodec *

A pointer to the plugin's write codec.


SetImageWriteCodec()

protected: IMPORT_C void SetImageWriteCodec(CImageWriteCodec *aImageWriteCodec) const;

Description

Sets the plugin's write codec.

Ownership of the codec is transferred to the plugin.

Parameters

CImageWriteCodec *aImageWriteCodec

A pointer to the codec.


StartPosition()

protected: IMPORT_C TInt &StartPosition() const;

Description

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

Return value

TInt &

The starting position.


Position()

protected: IMPORT_C TInt &Position() const;

Description

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

Return value

TInt &

The current position.


FrameInfoOverallSizeInPixels()

protected: IMPORT_C const TSize &FrameInfoOverallSizeInPixels() const;

Description

Returns the overall size of the image frame in pixels.

Return value

const TSize &

The size of the image frame.


PrepareEncoderL()

protected: virtual void PrepareEncoderL(const CFrameImageData *aFrameImageData)=0;

Description

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

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

Parameters

const CFrameImageData *aFrameImageData

The parameters which can be passed on to the encoding algorithm. This data might be used to determine the exact codec created.


UpdateHeaderL()

protected: virtual void UpdateHeaderL()=0;

Description

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 funtion that each individual plugin must implement.


CurrentImageSizeL()

protected: IMPORT_C TInt CurrentImageSizeL() const;

Description

Returns the current size of the encoded image in bytes.

Return value

TInt

The current size of the encoded image in bytes.


RequestComplete()

protected: IMPORT_C void RequestComplete(TInt aReason);

Description

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

Parameters

TInt aReason

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


SelfComplete()

protected: IMPORT_C void SelfComplete(TInt aReason);

Description

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

Parameters

TInt aReason

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


SetSelfPending()

protected: IMPORT_C void SetSelfPending();

Description

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()


HandleCustomSyncL()

protected: virtual IMPORT_C void HandleCustomSyncL(TInt aParam);

Description

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 aParam

Interpretation dependent on plugin.


InitCustomAsyncL()

protected: virtual IMPORT_C void InitCustomAsyncL(TInt aParam);

Description

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 aParam

Interpretation dependent on plugin.


NotifyComplete()

protected: virtual IMPORT_C void NotifyComplete();

Description

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.


AmInThread()

protected: IMPORT_C TBool AmInThread() const;

Description

Indicates if this encoder is running in a separate thread.

Return value

TBool

A boolean indicating if the encoder is running in a seperate thread. ETrue if running in separate thread, otherwise EFalse.


ShouldAbort()

protected: IMPORT_C TBool ShouldAbort() const;

Description

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.

Return value

TBool

A boolean indicating if the encode should abort early. ETrue if should abort early, otherwise EFalse.


WriteExifDataL()

private: virtual IMPORT_C void WriteExifDataL(TRequestStatus *&aScaleCompletionStatus);

Description

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

Parameters

TRequestStatus *&aScaleCompletionStatus