videditor/VideoEditorUiComponents/inc/VeiVideoDisplay.h
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 * Declares VeiCutAudioBar control for the video editor application.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef VEIVIDEODISPLAY_H
       
    23 #define VEIVIDEODISPLAY_H
       
    24 
       
    25 #include <coecntrl.h>
       
    26 #include <coemain.h>
       
    27 #include <VideoPlayer.h>
       
    28 
       
    29 const TInt KMaxVolumeLevel = 10;
       
    30 
       
    31 class CAknBitmapAnimation;
       
    32 /**
       
    33  * Observer for notifying that video player
       
    34  * has finished playing
       
    35  *
       
    36  * 
       
    37  */
       
    38 class MVeiVideoDisplayObserver
       
    39 	{
       
    40 public:
       
    41 		enum TPlayerEvent
       
    42 		{
       
    43         EStop = 0x90, 
       
    44 		ELoadingStarted,
       
    45 		EOpenComplete,
       
    46         EPlayComplete,
       
    47 		EBufferingStarted,
       
    48 		ELoadingComplete,
       
    49 		EVolumeLevelChanged,
       
    50 		EError
       
    51 		};
       
    52 	/**
       
    53 	 * Called to notify that amr conversion is completed
       
    54 	 * 
       
    55 	 * @param aConvertedFilename   converted filename.
       
    56 	 * @param aError  <code>KErrNone</code> if conversion was
       
    57 	 *                completed successfully; one of the system wide
       
    58 	 *                error codes if conversion failed
       
    59 	 */
       
    60 	virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo = 0 ) = 0;
       
    61 	
       
    62 
       
    63 	};
       
    64 /**
       
    65  * CVeiVideoDisplay control class.
       
    66  */
       
    67 class CVeiVideoDisplay :	public CCoeControl, 
       
    68 							public MVideoPlayerUtilityObserver,
       
    69 							public MVideoLoadingObserver,
       
    70 							public MCoeForegroundObserver
       
    71     {
       
    72     public:
       
    73         /**
       
    74          * Destructor.
       
    75          */
       
    76         IMPORT_C virtual ~CVeiVideoDisplay();
       
    77 
       
    78 		/** 
       
    79 		 * Static factory method.
       
    80 		 * 
       
    81 		 * @return  the created CVeiVideoDisplay object
       
    82 		 */
       
    83 		IMPORT_C static CVeiVideoDisplay* NewL( const TRect& aRect, const CCoeControl* aParent,
       
    84 			 MVeiVideoDisplayObserver& aObserver );
       
    85 
       
    86 		/** 
       
    87 		 * Static factory method. Leaves the created object in the cleanup
       
    88 		 * stack.
       
    89 		 *
       
    90 		 * @return  the created CVeiCutAudioBar object
       
    91 		 */
       
    92 		IMPORT_C static CVeiVideoDisplay* NewLC( const TRect& aRect, const CCoeControl* aParent,
       
    93 			 MVeiVideoDisplayObserver& aObserver);
       
    94 
       
    95 	public:
       
    96 
       
    97 		IMPORT_C TInt Volume() const;
       
    98 		IMPORT_C void ShowAnimationL( TInt aResourceId, TInt aFrameIntervalInMilliSeconds=-1 );
       
    99 		IMPORT_C void StopAnimation();
       
   100 		IMPORT_C void OpenFileL( const TDesC& aFilename );
       
   101 
       
   102 		IMPORT_C void Play();
       
   103 		IMPORT_C void PlayL( const TDesC& aFilename,
       
   104 					const TTimeIntervalMicroSeconds& aStartPoint = 0, 
       
   105 					const TTimeIntervalMicroSeconds& aEndPoint = 0);
       
   106 					
       
   107 		IMPORT_C void PlayMarkedL( const TTimeIntervalMicroSeconds& aStartPoint, 
       
   108 			const TTimeIntervalMicroSeconds& aEndPoint);
       
   109 
       
   110 		IMPORT_C void Stop( TBool aCloseStream );
       
   111 
       
   112 		IMPORT_C void PauseL();
       
   113 
       
   114 		IMPORT_C void ShowPictureL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask );
       
   115 
       
   116 		IMPORT_C void ShowPictureL( const CFbsBitmap& aBitmap );
       
   117 
       
   118         IMPORT_C void SetPictureL( const CFbsBitmap& aBitmap );
       
   119 
       
   120 		IMPORT_C void ShowBlankScreen();
       
   121 
       
   122         IMPORT_C void ShowBlackScreen();
       
   123 
       
   124         IMPORT_C void SetBlackScreen( TBool aBlack );
       
   125 
       
   126 		IMPORT_C TTimeIntervalMicroSeconds PositionL() const;
       
   127 
       
   128 		IMPORT_C void SetPositionL( const TTimeIntervalMicroSeconds& aPosition );
       
   129 
       
   130 		IMPORT_C TInt GetBorderWidth() const;
       
   131 
       
   132 		IMPORT_C TSize GetScreenSize() const;
       
   133 
       
   134 		IMPORT_C TTimeIntervalMicroSeconds TotalLengthL();
       
   135 
       
   136 		IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
       
   137 
       
   138         IMPORT_C void SetRotationL(TVideoRotation aRotation);
       
   139 
       
   140         IMPORT_C TVideoRotation RotationL() const;
       
   141 
       
   142 		IMPORT_C void SetMuteL( TBool aMuted );
       
   143 
       
   144 		IMPORT_C void AdjustVolumeL( TInt aIncrement );
       
   145 
       
   146 	public:
       
   147 		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   148 
       
   149 	private: // From MCoeForegroundObserver
       
   150 
       
   151 		virtual void HandleGainingForeground();
       
   152 		virtual void HandleLosingForeground();
       
   153 
       
   154 	private:
       
   155 		TInt TimeIncrement(TInt aKeyCount) const;
       
   156 
       
   157 		virtual void HandleResourceChange(TInt aType); 
       
   158 		 /**
       
   159          * Default constructor.
       
   160 		 *
       
   161          */
       
   162         void ConstructL( const TRect& aRect, const CCoeControl* aParent );
       
   163 		 /**
       
   164          * C++ default constructor.
       
   165 		 *
       
   166          */
       
   167         CVeiVideoDisplay( MVeiVideoDisplayObserver& aObserver );
       
   168 		/*
       
   169         * From CoeControl,SizeChanged.
       
   170         */
       
   171         void SizeChanged();
       
   172 
       
   173 		// From MVideoPlayerUtilityObserver
       
   174 		void MvpuoOpenComplete( TInt aError );
       
   175 		void MvpuoFrameReady( CFbsBitmap& aFrame, TInt aError );
       
   176 		void MvpuoPlayComplete( TInt aError );
       
   177 		void MvpuoPrepareComplete( TInt aError );
       
   178 		void MvpuoEvent( const TMMFEvent& aEvent );
       
   179 		void MvloLoadingStarted();
       
   180 		void MvloLoadingComplete();
       
   181        /**
       
   182         * From CCoeControl,Draw.
       
   183 		*
       
   184 		* @param aRect  rectangle to draw
       
   185         */
       
   186         void Draw(const TRect& aRect) const;
       
   187 
       
   188 		TRect CalculateVideoPlayerArea();
       
   189 		
       
   190 		void LocateEntryL();
       
   191 		
       
   192 		void SetPlaybackVolumeL();
       
   193 
       
   194 		void StoreDisplayBitmapL( const CFbsBitmap& aBitmap, const CFbsBitmap* aMask = NULL);
       
   195 
       
   196        /**
       
   197         * Set the animation's frame interval via a callback. 
       
   198         * This is needed because if the frame interval is altered immediately
       
   199         * after the animation is started, the change does not take effect visually.
       
   200 		* There must be some delay in between.
       
   201         */
       
   202 		void SetAnimationFrameIntervalCallbackL();
       
   203 		static TInt SetAnimationFrameIntervalCallbackMethod(TAny* aThis);
       
   204 
       
   205     private:	// data
       
   206 
       
   207 		/** Video player utility. */
       
   208 		CVideoPlayerUtility*	iVideoPlayerUtility;
       
   209 		CFbsBitmap*				iDisplayBitmap;
       
   210 		CFbsBitmap*				iDisplayMask;
       
   211 
       
   212 		CFbsBitmap*				iBgSquaresBitmap;
       
   213 		CFbsBitmap*				iBgSquaresBitmapMask;
       
   214 
       
   215 		MVeiVideoDisplayObserver&	iObserver;
       
   216 		TBool					iBlank;
       
   217 		TInt					iBorderWidth;
       
   218 		TTimeIntervalMicroSeconds	iDuration;
       
   219 		/** Videoplayerutility volume */
       
   220 		TInt 					iInternalVolume;
       
   221 
       
   222 		/** Max volume */
       
   223 		TInt 					iMaxVolume;
       
   224 
       
   225 		
       
   226 		TBool					iAnimationOn;
       
   227         TBool					iBlack;
       
   228 		CAknBitmapAnimation*	iAnimation;
       
   229 		TInt					iAnimationResourceId;
       
   230 		TInt					iAnimationFrameIntervalInMilliSeconds;
       
   231 		TInt					iStoredAnimationFrameIntervalInMilliSeconds;
       
   232 
       
   233 		/** Seek thumbnail position in video clip. */
       
   234 		//TTimeIntervalMicroSeconds iSeekPos;
       
   235 		
       
   236 		TInt					iKeyRepeatCount;
       
   237 
       
   238 		TBool					iSeeking;
       
   239 		TBool					iBufferingCompleted;
       
   240 		
       
   241 		TBool					iMuted;
       
   242 		
       
   243 		HBufC* 						iFilename;
       
   244 		TTimeIntervalMicroSeconds	iStartPoint;
       
   245 		TTimeIntervalMicroSeconds	iEndPoint;
       
   246 		
       
   247 		TBool						iNewFile;
       
   248 
       
   249 		/** Callback utility for setting the animation frame interval*/
       
   250 		CAsyncCallBack* 			iCallBack;
       
   251     };
       
   252 #endif
       
   253 
       
   254 // End of File