diff -r 000000000000 -r 5752a19fdefe imaging/imagingfws/ImageProcessor/src/imageprocessorimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imaging/imagingfws/ImageProcessor/src/imageprocessorimpl.h Wed Aug 25 12:29:52 2010 +0300 @@ -0,0 +1,308 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __IMAGE_PROCESSOR_IMPL_H__ +#define __IMAGE_PROCESSOR_IMPL_H__ + +#include + +#include +#include + +namespace ImageProcessor + { + class CImgProcessor; + class MImgProcessorPlugin; + class MImgProcessorObserver; + class CImageProcessorCallback; + class TEffect; + class TPreview; + class TOverlay; + class TProgressInfo; + class TInputInfo; + class TOutputInfo; + namespace Plugin + { + class MEffect; + class MPreview; + class MOverlay; + class MProgressInfo; + class MInputInfo; + class MOutputInfo; + } + +NONSHARABLE_CLASS(CImageProcessorDrmInput) : public CBase + { +public: + static CImageProcessorDrmInput* NewL(TMMSource& aDrmFile); + + public: + void ExecuteIntentL(); + ~CImageProcessorDrmInput(); + + inline HBufC8* Buffer(); + + private: + void ConstructL(TMMSource& aDrmFile); + + private: + HBufC8* iDecryptedBuffer; + ContentAccess::CContent* iContent; + ContentAccess::CData* iData; + ContentAccess::TIntent iIntent; + }; + +inline HBufC8* CImageProcessorDrmInput::Buffer() + { + return iDecryptedBuffer; + } + +NONSHARABLE_CLASS(CImageProcessorImpl) : public CBase, public MImgProcessorPluginObserver + { +private: + static const TBool iValidStates[CImgProcessor::EStatesCount][CImgProcessor::EStatesCount]; + +public: + static CImageProcessorImpl* NewL(RFs& aFileServerSession,CImgProcessor& aImageProcessor,MImgProcessorObserver& aObserver,TUid aPluginUid); + void Cleanup(); + + void SupportedEffectsL(RArray& aEffects) const; + + void SupportedInputFormatsL(RArray& aFormats) const; + void SupportedInputSubFormatsL(TUid aFormat, RArray& aSubFormats) const; + void SupportedInputImageFrameFormatsL(RArray& aFormats) const; + void SupportedInputDisplayModesL(RArray& aDisplayModes) const; + + void SupportedOutputFormatsL(RArray& aFormats) const; + void SupportedOutputSubFormatsL(TUid aFormat, RArray& aSubFormats) const; + void SupportedOutputImageFrameFormatsL(RArray& aFormats) const; + void SupportedOutputDisplayModesL(RArray& aDisplayModes) const; + + TUint64 SupportedOptions() const; + TUint SupportedOperations() const; + + CImgProcessor::TState State() const; + TSize CurrentSizeL() const; + TRgb BackgroundColorL() const; + + TInt CalculatePixelBufferSizeL(TSize aSizeInPixels, TDisplayMode aDisplayMode, TUint32 aScanLineLength = 0) const; + TInt CalculatePixelBufferSizeL(TSize aSizeInPixels, const TUid& aFormat, TUint32 aScanLineLength = 0) const; + + void CreateInputL(CFbsBitmap& aBitmap); + void CreateInputL(CImageFrame& aPixelBuffer); + void CreateInputL(const TSize& aSize, const TRgb& aColor); + + void SetBackgroundColorL(const TRgb& aColor); + + void SetInputRectL(const TRect& aRect); + + void SetInputL(const TDesC& aFilename, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetInputL(RFile& aFile, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetInputL(TMMSource& aDrmFile, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetInputL(const TDesC8& aBuffer, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetInputL(const CFbsBitmap& aBitmap, const CFbsBitmap* aMask = NULL); + void SetInputL(const CImageFrame& aPixelBuffer); + void SetInputL(CImagePanorama& aPanorama); + + + void SetOptionsL(TUint64 aOptions); + void ApplyOperationL(CImgProcessor::TOperation aOperation); + + void InputUpdatedL(); + void ResetL(); + + void InitializeL(TUint64 aOptions); + + void ProcessL(const TSize& aSize, TBool aMaintainAspectRatio); + void Cancel(); + + TEffect* EffectL(TUid aEffect); + + TBool CanUndoL() const; + void UndoL(); + void UndoAllL(); + + TBool CanRedoL() const; + void RedoL(); + void RedoAllL(); + + TPreview* PreviewL(TInt aPreviewId); + + TOverlay* OverlayL(); + + TProgressInfo* ProgressInfoL(); + TInputInfo* InputInfoL(); + TOutputInfo* OutputInfoL(); + + void SetOutputL(const TDesC& aFilename, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetOutputL(RFile& aFile, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetOutputL(RBuf8& aBuffer, const TUid& aFormat = KNullUid, const TUid& aSubFormat = KNullUid); + void SetOutputL(CImageFrame& aPixelBuffer); + void SetOutputL(CFbsBitmap& aBitmap, CFbsBitmap* aMask = NULL); + + TAny* Extension(TUid aExtension); + + // framework utility functions + void ConvertMimeTypeToUidL(const TDesC8& aMimeType, TUid& aFormat, TUid& aSubFormat); + void ConvertFileExtensionToUidL(const TDesC& aFileExtension, TUid& aFormat, TUid& aSubFormat); + void ConvertUidToMimeTypeL(TDes8& aMimeType, const TUid& aFormat, const TUid& aSubFormat); + void ConvertUidToFileExtensionL(TDes& aFileExtension, const TUid& aFormat, const TUid& aSubFormat); + + ~CImageProcessorImpl(); + + void PostEvent(TInt aEventId, TUid aUid, TInt aId, TInt aError); + void ProcessEventL(TInt aEventId, TUid aUid, TInt aId, TInt aError); + void SetStateL(CImgProcessor::TState aState); + void RestoreStateL(); + + TBool IsBusy(CImgProcessor::TState aState) const; + void CheckStateL(CImgProcessor::TState aState) const; + + void AppendOverlayDrmInputL(); + + inline RArray& PreviewOutputImageFrameFormatsL(); + inline RArray& PreviewOutputDisplayModesL(); + inline RArray& OverlayInputFormatsL(); + inline RArray& OverlayInputImageFrameFormatsL(); + inline RArray& OverlayInputDisplayModesL(); + + inline void SetOverlayDrmInput(CImageProcessorDrmInput* aOverlayDrmInput); + inline void ResetOverlayDrmInput(); + + inline TBool IsInputSet() const; + inline TBool IsOutputSet() const; + inline TUint64 Options() const; + +private: + CImageProcessorImpl(RFs& aFileServerSession, CImgProcessor& aImageProcessor, TUid aPluginUid); + void ConstructL(MImgProcessorObserver& aObserver); + + void CheckInputFormatL(const TUid& aFormat, const TUid& aSubFormat); + void CheckOutputFormatL(const TUid& aFormat, const TUid& aSubFormat); + TBool IsFrameworkEffect(TUid aEffect) const; + TBool IsPluginEffect(TUid aEffect) const; + void InitializeFrameworkEffectsL(); + + TEffect* FindEffect(TUid aEffect) const; + TEffect* CreateEffectL(TUid aEffect); + TEffect* EffectFactoryL(TUid aEffect, Plugin::MEffect* aPluginEffect); + + TPreview* FindPreview(TInt aPreviewId) const; + +private: + RFs& iFileServerSession; + CImgProcessor& iImageProcessor; + TUid iPluginUid; + + CImgProcessor::TState iState; + CImgProcessor::TState iPreviousState; + + CImageProcessorCallback* iCallbackHandler; + + MImgProcessorPlugin* iPlugin; + TUid iPluginDtorKey; + + TOverlay* iOverlay; + TProgressInfo* iProgressInfo; + TInputInfo* iInputInfo; + TOutputInfo* iOutputInfo; + + CImageProcessorDrmInput* iDrmInput; + CImageProcessorDrmInput* iOverlayDrmInput; + + RPointerArray iEffects; + RPointerArray iPreviews; + RPointerArray iOverlayDrmInputs;// to keep all decrypted buffer during session + + RArray iFrameworkEffects; + RArray iPluginEffects; + RArray iInputFormats; + RArray iInputImageFrameFormats; + RArray iInputDisplayModes; + RArray iOutputFormats; + RArray iOutputImageFrameFormats; + RArray iOutputDisplayModes; + + RArray iPreviewOutputImageFrameFormats; + RArray iPreviewOutputDisplayModes; + RArray iOverlayInputFormats; + RArray iOverlayInputImageFrameFormats; + RArray iOverlayInputDisplayModes; + + RFileExtensionMIMETypeArray iTypesUtilityArray; + + TUint64 iSupportedOptions; + TUint64 iOptions; + TUint iSupportedOperations; + + TBool iIsInputSet; + TBool iIsOutputSet; + }; + +inline RArray& CImageProcessorImpl::PreviewOutputImageFrameFormatsL() + { + return iPreviewOutputImageFrameFormats; + } + +inline RArray& CImageProcessorImpl::PreviewOutputDisplayModesL() + { + return iPreviewOutputDisplayModes; + } + +inline RArray& CImageProcessorImpl::OverlayInputFormatsL() + { + return iOverlayInputFormats; + } + +inline RArray& CImageProcessorImpl::OverlayInputImageFrameFormatsL() + { + return iOverlayInputImageFrameFormats; + } + +inline RArray& CImageProcessorImpl::OverlayInputDisplayModesL() + { + return iOverlayInputDisplayModes; + } + +inline TBool CImageProcessorImpl::IsInputSet() const + { + return iIsInputSet; + } + +inline TBool CImageProcessorImpl::IsOutputSet() const + { + return iIsOutputSet; + } + +inline TUint64 CImageProcessorImpl::Options() const + { + return iOptions; + } + +inline void CImageProcessorImpl::SetOverlayDrmInput(CImageProcessorDrmInput* aOverlayDrmInput) + { + ResetOverlayDrmInput(); + iOverlayDrmInput = aOverlayDrmInput; + } + +inline void CImageProcessorImpl::ResetOverlayDrmInput() + { + delete iOverlayDrmInput; + iOverlayDrmInput = NULL; + } + + } // ImageProcessor + +#endif //__IMAGE_PROCESSOR_IMPL_H__