videditor/TrimForMms/inc/VeiTrimForMmsContainer.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 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef VEITRIMFORMMSCONTAINER_H
       
    23 #define VEITRIMFORMMSCONTAINER_H
       
    24 
       
    25 // INCLUDES
       
    26 // System includes
       
    27 #include <AknUtils.h>   // TAknLayoutText
       
    28 #include <coecntrl.h>
       
    29 #include <AknProgressDialog.h> 
       
    30 #include <VedMovie.h>
       
    31 #include <VedVideoClipInfo.h>
       
    32 // User includes
       
    33 #include "VeiVideoDisplay.h"
       
    34 #include "VeiFrameTaker.h"
       
    35 #include "VeiTrimForMmsView.h"
       
    36 #include "VeiDisplayLighter.h"
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CVeiCutterBar;
       
    40 class CVeiTrimForMmsView;
       
    41 class CVeiTrimForMmsView;
       
    42 class CAknsBasicBackgroundControlContext;
       
    43 class CAknProgressDialog;
       
    44 //class CEikProgressInfo;
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 /**
       
    49  *
       
    50  */
       
    51 class CVeiTrimForMmsContainer : public CCoeControl,
       
    52                                 public MVedMovieObserver,
       
    53                                 public MVeiVideoDisplayObserver,
       
    54 								public MVeiFrameTakerObserver,
       
    55 								public MProgressDialogCallback
       
    56     {
       
    57     public:
       
    58 
       
    59         static CVeiTrimForMmsContainer* NewL( const TRect& aRect,
       
    60                                               CVedMovie& aMovie,
       
    61 											  CVeiTrimForMmsView& aView );
       
    62 
       
    63         static CVeiTrimForMmsContainer* NewLC( const TRect& aRect,
       
    64                                                CVedMovie& aMovie,
       
    65 											   CVeiTrimForMmsView& aView);
       
    66 
       
    67         ~CVeiTrimForMmsContainer();
       
    68 
       
    69     public:     // New functions
       
    70 
       
    71         const TTimeIntervalMicroSeconds& CutInTime() const;
       
    72 
       
    73         const TTimeIntervalMicroSeconds& CutOutTime() const;
       
    74 
       
    75 		void SetMaxMmsSize( TInt aMaxSizeInBytes );
       
    76 
       
    77 		/**
       
    78 		 * Start full screen preview. Calls CVeiVideoDisplay. 
       
    79 		 *
       
    80 		 * @param aFilename filename.
       
    81 		 * @param aRect full screen size.
       
    82 		 */
       
    83 		void PlayL( const TDesC& aFilename, const TRect& aRect  );
       
    84 
       
    85 		/**
       
    86 		 *	Stop preview. Stops CVeiVideoDisplay
       
    87 		 *
       
    88 		 * @param aCloseStream 
       
    89 		 */
       
    90 		void Stop( TBool aCloseStream );
       
    91 
       
    92 		/**
       
    93 		 *
       
    94 		 */
       
    95 		void PauseL();
       
    96 
       
    97 		/**
       
    98          * Return the video display state of CVeiTrimForMmsContainer. 
       
    99          *
       
   100          * @param 
       
   101          */
       
   102 		TInt PreviewState() const;
       
   103 
       
   104 		void StartFrameTakerL( TInt aIndex );
       
   105 
       
   106     private:    // From CCoeControl
       
   107 
       
   108 		virtual void DialogDismissedL( TInt aButtonId );
       
   109 
       
   110         CCoeControl* ComponentControl(TInt aIndex) const;    
       
   111 
       
   112         TInt CountComponentControls() const;
       
   113 
       
   114         /**
       
   115          * Gets the control's help context. Associates the control with a 
       
   116          * particular Help file and topic in a context sensitive application.
       
   117          *
       
   118          * @param aContext The control's help context.
       
   119          */
       
   120         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   121 
       
   122         void Draw( const TRect& aRect ) const;
       
   123 
       
   124         void SizeChanged();
       
   125 
       
   126         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   127 											TEventCode aType);
       
   128 
       
   129     private:    // From MVeiVideoDisplayObserver
       
   130       
       
   131         virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo = 0 );
       
   132 
       
   133 		virtual void NotifyFramesCompleted( CFbsBitmap* aFirstFrame, CFbsBitmap* aLastFrame, 
       
   134             CFbsBitmap* /*aTimelineFrame*/, TInt aError );
       
   135 
       
   136 
       
   137 		/**
       
   138 		 * Gets an object whose type is encapsulated by the specified TTypeUid 
       
   139 		 * object.
       
   140 		 *
       
   141 		 * @param aId Encapsulates the Uid that identifies the type of object
       
   142 		 * required.
       
   143 		 *
       
   144 		 * @return
       
   145 		 */
       
   146 		virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   147 
       
   148     protected:  // From MVedMovieObserver
       
   149 
       
   150         virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
       
   151 
       
   152 	    virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);
       
   153 
       
   154     	virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
       
   155 	
       
   156 	    virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
       
   157 									           TInt aNewIndex);
       
   158 
       
   159     	virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
       
   160 											   TInt aIndex);
       
   161 
       
   162     	virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
       
   163 												   TInt aIndex);
       
   164 	
       
   165 	    virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
       
   166 											         TInt aIndex);
       
   167 
       
   168 	    virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
       
   169 											             TInt aIndex);
       
   170 
       
   171 	    virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
       
   172 																TInt aIndex);
       
   173 
       
   174 	    virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
       
   175 
       
   176 	    virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
       
   177 													 TInt aIndex);
       
   178 
       
   179 	    virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
       
   180 
       
   181 	    virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
       
   182 
       
   183 	    virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
       
   184 
       
   185 	    virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
       
   186 
       
   187         virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
       
   188 									           TInt aNewIndex);
       
   189 
       
   190 	    virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
       
   191 											   TInt aIndex);
       
   192 
       
   193         virtual void NotifyMovieQualityChanged(CVedMovie& aMovie);
       
   194 
       
   195         virtual void NotifyMovieReseted(CVedMovie& aMovie);
       
   196 
       
   197 		virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
       
   198 
       
   199 	    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
       
   200                                                          TInt aClipIndex, 
       
   201                                                          TInt aMarkIndex);
       
   202 
       
   203 		virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
       
   204                                                         TInt aClipIndex, 
       
   205                                                         TInt aMarkIndex);
       
   206 
       
   207 		virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
       
   208                                                          TInt aClipIndex, 
       
   209                                                          TInt aMarkIndex);
       
   210 
       
   211 		virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
       
   212                                                         TInt aClipIndex, 
       
   213                                                         TInt aMarkIndex);  
       
   214 
       
   215     private:    // New functions
       
   216 		TInt TimeIncrement(TInt aKeyCount) const;
       
   217 
       
   218     private:    // Constructors
       
   219 
       
   220         CVeiTrimForMmsContainer( CVedMovie& aMovie, CVeiTrimForMmsView& aView);
       
   221 
       
   222         void ConstructL( const TRect& aRect );
       
   223 
       
   224     private:    // Enumeration
       
   225         
       
   226         enum TTrimForMmsControls
       
   227             {
       
   228             ECutFrame,
       
   229             EVideoDisplayStart,
       
   230             EVideoDisplayEnd,
       
   231 			EVideoPreview,
       
   232             ENumberOfControls   // This is always the last one!
       
   233             };
       
   234 
       
   235 	public:
       
   236 		enum TPreviewState
       
   237 			{
       
   238 			EIdle = 0,
       
   239 			ELoading,
       
   240 			EPreview,
       
   241 			EPlaying,
       
   242 			EStop,
       
   243 			EStopAndExit,
       
   244 			EOpeningFile,
       
   245 			EPause
       
   246 			};
       
   247 
       
   248     private:    // Data
       
   249 
       
   250         /**
       
   251          * Whether or not the last key pressed was left or right navi-key.
       
   252          */
       
   253         TBool                   iLastKeyLeftOrRight;
       
   254 
       
   255         /**
       
   256          *
       
   257          */
       
   258         TInt                    iVideoDisplayStartIndex;        
       
   259 
       
   260         /**
       
   261          *
       
   262          */
       
   263         TInt                    iVideoDisplayEndIndex;
       
   264 
       
   265         /**
       
   266          *
       
   267          */
       
   268         TRect                   iVideoDisplayEndRect;
       
   269 
       
   270         /**
       
   271          * Text layout for main pane's end text.
       
   272          */
       
   273         TAknLayoutText          iLayoutTextEnd;
       
   274 
       
   275         /**
       
   276          * Text layout for main pane's start text.
       
   277          */
       
   278         TAknLayoutText          iLayoutTextStart;
       
   279 
       
   280         /**
       
   281          * Layout for start thumbnail.
       
   282          */
       
   283         TAknLayoutRect          iLayoutRectStart;
       
   284 
       
   285         /**
       
   286          * Layout for end thumbnail.
       
   287          */
       
   288         TAknLayoutRect          iLayoutRectEnd;
       
   289 
       
   290         /**
       
   291          * Layout for trim timeline icon.
       
   292          */
       
   293         TAknLayoutRect          iLayoutRectIcon;
       
   294 
       
   295         /**
       
   296          * Layout for cut frame.
       
   297          */
       
   298         TAknLayoutRect iLayoutRectCutFrame;
       
   299 
       
   300         /**
       
   301          * Text shown above the end thumbnail.
       
   302          */
       
   303         HBufC*                  iEndText;
       
   304 
       
   305         /**
       
   306          * Text shown above the start thumbnail.
       
   307          */
       
   308         HBufC*                  iStartText;
       
   309 
       
   310         /**
       
   311          *
       
   312          */
       
   313 		CVeiCutterBar*			iCutterBar;
       
   314         /**
       
   315          *
       
   316          */
       
   317         CVedMovie&              iMovie;
       
   318 
       
   319         /**
       
   320          *
       
   321          */
       
   322         CVeiVideoDisplay*       iVideoDisplayStart;
       
   323 
       
   324         /**
       
   325          *
       
   326          */
       
   327         CVeiVideoDisplay*       iVideoDisplayEnd;
       
   328 
       
   329 		CVeiVideoDisplay*		iVideoDisplay;
       
   330 
       
   331 		TPreviewState			iPreviewState;
       
   332 				
       
   333 		TRect					iPreviewRect;
       
   334 
       
   335 		CVeiFrameTaker*			iFrameTaker;
       
   336 
       
   337 		/*
       
   338 		 * Updated by NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex ) 
       
   339 		 */
       
   340 		TInt					iClipIndex;
       
   341 
       
   342 		CVeiTrimForMmsView&		iView;
       
   343 
       
   344 
       
   345 		TRect					iStartTextBox;
       
   346 		TRect					iEndTextBox;
       
   347 		TRect					iVideoDisplayStartRect;
       
   348 		TRect					iTimelineRect;
       
   349 		TRect					iCutIconRect;
       
   350 		TRect					iAdjustRect;
       
   351 
       
   352 		TPoint					iCutIconPoint;
       
   353 		TSize					iCutIconSize;
       
   354 
       
   355 		TTimeIntervalMicroSeconds	iSeekPos;
       
   356 		TTimeIntervalMicroSeconds	iSeekEndPos;
       
   357 		TTimeIntervalMicroSeconds	iDuration;
       
   358 		TInt					iKeyRepeatCount;
       
   359 		/** Background context. Skin stuff. */
       
   360 		CAknsBasicBackgroundControlContext*	iBgContext;
       
   361 
       
   362 		CVeiDisplayLighter*		iScreenLight;
       
   363 		TInt					iMaxMmsSize;
       
   364 		TBool 					iBlack;
       
   365 
       
   366 
       
   367 		TBool					iSeekEvent;
       
   368 		  /**
       
   369          * Progress dialog.
       
   370          */
       
   371         CAknProgressDialog*		iProgressNote;
       
   372 
       
   373 		/** Progress info for the progress note. */
       
   374 		CEikProgressInfo* 		iProgressInfo;
       
   375 		TBool 					iKeyEnable;
       
   376     };
       
   377 
       
   378 #endif