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