Location:
ImagePlugin.h
Link against: imageconversion.lib
class CImageDecoderPlugin : public CBase;
The PluginAPI for Image Converter Library decoder plugins.
Intended for use by plugin writers only.
CBase
- Base class for all classes to be instantiated on the heap
CImageDecoderPlugin
- The PluginAPI for Image Converter Library decoder plugins
Defined in CImageDecoderPlugin
:
AmInThread()
, AppendImageData()
, AppendImageDataBuffer()
, CImageDecoderPlugin()
, Cleanup()
, DataLength()
, Destination()
, DestinationMask()
, DoConvert()
, FrameBlockSize()
, FrameCommentL()
, FrameData()
, FrameHeaderBlockSize()
, FrameInfo()
, FrameInfoStringsL()
, HandleCustomSyncL()
, HandleProcessFrameResult()
, ImageCommentL()
, ImageData()
, ImageDataCount()
, ImageInfo()
, ImageReadCodec()
, ImageType()
, InitConvertL()
, InitCustomAsyncL()
, InsertImageData()
, IsImageHeaderProcessingComplete()
, NotifyComplete()
, NumberOfFrameComments()
, NumberOfFrames()
, NumberOfImageComments()
, OpenExtraResourceFileLC()
, Position()
, PrepareForProcessFrameL()
, ReadDataL()
, ReadFrameHeadersL()
, RemoveImageData()
, RequestComplete()
, RequestInitL()
, ScanDataL()
, SelfComplete()
, SetDataLength()
, SetImageInfo()
, SetImageReadCodec()
, SetPosition()
, SetSelfPending()
, SetStartPosition()
, SetThumbnailData()
, ShouldAbort()
, SourceData()
, SourceLength()
, StartPosition()
, ValidDestination()
, ValidDestinationMask()
, ~CImageDecoderPlugin()
Inherited from CBase
:
Delete()
,
Extension_()
,
operator new()
virtual IMPORT_C TInt NumberOfImageComments() const;
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.
|
virtual IMPORT_C HBufC *ImageCommentL(TInt aCommentNumber) const;
Returns a particular comment attatched to the image. Ownership of the returned buffer is transferred to the caller.
|
|
virtual IMPORT_C TInt NumberOfFrameComments(TInt aFrameNumber) const;
Returns the number of comments attatched to a given frame of the image.
Use NumberOfImageComments()
for the image equivalent.
|
|
virtual IMPORT_C HBufC *FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
Returns a particular comment attatched to a given frame of the image.
Ownership of the returned buffer is transferred to the caller.
|
|
virtual void ImageType(TInt aFrameNumber, TUid &aImageType, TUid &aImageSubType) const=0;
Returns the image type and sub-type for a given frame of the image that has just been opened.
This is a virtual funtion that each individual plugin must implement.
|
protected: virtual IMPORT_C void Cleanup();
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.
protected: virtual IMPORT_C void ReadFrameHeadersL();
Invokes the ReadFrameHeadersL method of the supplied plugin which should process the frame headers contained within the image.
protected: virtual void ScanDataL()=0;
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 funtion that each individual plugin must implement.
protected: virtual IMPORT_C TInt FrameHeaderBlockSize(TInt aFrameNumber) const;
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.
|
|
protected: virtual IMPORT_C TInt FrameBlockSize(TInt aFrameNumber) const;
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.
|
|
protected: virtual IMPORT_C CFrameInfoStrings *FrameInfoStringsL(RFs &aFs, TInt aFrameNumber=0)=0;
Returns the codec specific frame information stored in resource files.
This is a virtual funtion that each individual plugin must implement.
|
|
protected: IMPORT_C void OpenExtraResourceFileLC(RFs &aFs, const TUid aUid, RResourceFile &aResourceFile) const;
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.
|
protected: IMPORT_C void ReadDataL(TInt aPosition, TPtrC8 &aReadBuffer, TInt aLength);
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.
|
protected: virtual IMPORT_C void InitConvertL();
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.
protected: IMPORT_C void RequestInitL(TInt aFrameNumber);
Forces initialization of data structures prior to decoding a frame.
|
protected: virtual IMPORT_C void DoConvert();
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.
protected: IMPORT_C void PrepareForProcessFrameL();
Initialises system for ProcessFrameL(). This reads in a new buffer for ProcessFrameL().
protected: IMPORT_C void HandleProcessFrameResult(TInt aErrCode, TFrameState aCodecState);
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.
|
protected: IMPORT_C TBufPtr8 &SourceData();
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()
.
|
protected: IMPORT_C void RequestComplete(TInt aReason);
Must be called on completion of decoding the image data.
|
protected: IMPORT_C void SelfComplete(TInt aReason);
Must be called at the end of a slice of decoding.
If successful specify KErrNone that results in a repeat call to DoConvert()
.
|
protected: IMPORT_C void SetSelfPending();
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()
.
protected: IMPORT_C TBool IsImageHeaderProcessingComplete() const;
Returns the status of header processing. If the processing is incomplete or not terminated correctly EFalse will be returned
|
protected: IMPORT_C CImageReadCodec *ImageReadCodec() const;
Returns the plugin's read codec.
|
protected: IMPORT_C void SetImageReadCodec(CImageReadCodec *aImageReadCodec);
Sets the plugin's read codec. Ownership of the codec is transferred to the plugin.
|
protected: IMPORT_C const TFrameInfo &ImageInfo() const;
Returns image information such as colour depth, scaling support etc.
|
protected: IMPORT_C void SetImageInfo(const TFrameInfo &aImageInfo);
Sets the image information.
|
protected: IMPORT_C TInt NumberOfFrames() const;
Returns the number of frames to be decoded.
|
protected: IMPORT_C const TImageDataBlock *ImageData(TInt aIndex) const;
Returns the image data block for the specified index.
|
|
protected: IMPORT_C TInt InsertImageData(const TImageDataBlock *aEntry, TInt aPos);
Inserts an image data block into the internally held array at the specified position.
|
|
protected: IMPORT_C TInt AppendImageData(const TImageDataBlock *aEntry);
Appends a new image data data block to the end of the internally held array.
|
|
protected: IMPORT_C void RemoveImageData(TInt aPos);
Removes a specified image data block from the internally held array.
|
protected: IMPORT_C TInt ImageDataCount() const;
Returns the number of image data blocks present in the image data.
|
protected: IMPORT_C TInt AppendImageDataBuffer(const HBufC8 *aImageBuffer);
Appends a new image data buffer to the end of the internally held array
|
|
protected: IMPORT_C TInt DataLength() const;
Returns the maximum number of bytes of data that can be decoded.
|
protected: IMPORT_C void SetDataLength(TInt aDataLength);
Sets the maximum number of bytes of data that can be decoded.
|
protected: IMPORT_C TInt Position() const;
Returns the current position within the data.
|
protected: IMPORT_C void SetPosition(const TInt aPosition);
Sets the current position in the data.
|
protected: IMPORT_C TInt StartPosition() const;
Returns the starting position of the frame to be decoded.
|
protected: IMPORT_C void SetStartPosition(TInt aDataLength);
Sets the starting position of the frame to be decoded.
|
protected: IMPORT_C const CFbsBitmap &Destination() const;
Returns the destination bitmap.
|
protected: IMPORT_C TBool ValidDestination() const;
Returns the validity of the destination bitmap.
|
protected: IMPORT_C const CFbsBitmap &DestinationMask() const;
Returns the destination bitmap mask.
|
protected: IMPORT_C TBool ValidDestinationMask() const;
Indicates if the destination bitmap mask is valid.
|
protected: IMPORT_C const TFrameInfo &FrameInfo(TInt aFrameNumber=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 decoding it.
|
|
protected: IMPORT_C const CFrameImageData &FrameData(TInt aFrameNumber=0) const;
Returns the frame data for a specified frame of the image.
|
|
protected: IMPORT_C TInt SourceLength() const;
Returns the length of the source data in bytes.
|
protected: virtual IMPORT_C void HandleCustomSyncL(TInt aParam);
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.
|
protected: virtual IMPORT_C void InitCustomAsyncL(TInt aParam);
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.
|
protected: virtual IMPORT_C void NotifyComplete();
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.
protected: IMPORT_C TBool AmInThread() const;
Indicates if this decoder is running in a separate thread.
|
protected: IMPORT_C TBool ShouldAbort() const;
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.
|