videoeditorengine/vedengine/inc/VedMovieImp.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 7 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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 __VEDMOVIEIMP_H__
       
    23 #define __VEDMOVIEIMP_H__
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <f32file.h>
       
    28 #include "VedMovie.h"
       
    29 #include "VedVideoClip.h"
       
    30 #include "VedAudioClipInfoImp.h"
       
    31 #include "AudObservers.h"
       
    32 #include "AudCommon.h"
       
    33 #include "Vedqualitysettingsapi.h"
       
    34 #include "ctrtranscoder.h"
       
    35 
       
    36 
       
    37 #if ( defined (__WINS__) || defined (__WINSCW__) )
       
    38 const TInt KVEdMaxFrameRate = 10;
       
    39 #else 
       
    40 const TInt KVEdMaxFrameRate = 15;
       
    41 #endif
       
    42 
       
    43 
       
    44 /*
       
    45  *  Forward declarations.
       
    46  */
       
    47 class CMovieProcessor;
       
    48 class CVedMovie;
       
    49 class CVedMovieImp;
       
    50 class CVedMovieAddClipOperation;
       
    51 class CVedMovieProcessOperation;
       
    52 class CAudSong;
       
    53 class CVedCodecChecker;
       
    54 
       
    55 
       
    56 /**
       
    57  * Video movie, which consists of zero or more video clips and zero or more audio clips.
       
    58  *
       
    59  * @see  CVedVideoClip
       
    60  * @see  CVedAudioClip
       
    61  */
       
    62 class CVedMovieImp : public CVedMovie, MAudSongObserver, MVedAudioClipInfoObserver
       
    63     {
       
    64 public:
       
    65     /* Constructors. */
       
    66 
       
    67     CVedMovieImp(RFs *aFs);
       
    68 
       
    69     void ConstructL();
       
    70 
       
    71     /**
       
    72      * Destroys the object and releases all resources.
       
    73      */
       
    74     ~CVedMovieImp();
       
    75 
       
    76 
       
    77     /* Property methods. */
       
    78     
       
    79     /**
       
    80      * Returns the quality setting of this movie.
       
    81      *
       
    82      * @return  quality setting of this movie
       
    83      */
       
    84     TVedMovieQuality Quality() const;
       
    85 
       
    86     /**
       
    87      * Sets the quality setting of this movie.
       
    88      *
       
    89      * @param aQuality  quality setting
       
    90      */
       
    91     void SetQuality(TVedMovieQuality aQuality);
       
    92 
       
    93     /**
       
    94      * Returns the video format of this movie. 
       
    95      * 
       
    96      * @return  video format of this movie
       
    97      */
       
    98     TVedVideoFormat Format() const;
       
    99 
       
   100     /**
       
   101      * Returns the video type of this movie. 
       
   102      * 
       
   103      * @return  video type of this movie
       
   104      */
       
   105     TVedVideoType VideoType() const;
       
   106 
       
   107     /**
       
   108      * Returns the resolution of this movie. Panics with 
       
   109      * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
       
   110      * in the movie.
       
   111      * 
       
   112      * @return  resolution of the movie
       
   113      */
       
   114     TSize Resolution() const;
       
   115 
       
   116     /**
       
   117      * Returns the recommended maximum framerate of this movie..
       
   118      * <p>
       
   119      * Note that the returned maximum framerate is a recommendation,
       
   120      * not a guarantee. For example, the video clip generators inserted
       
   121      * in this movie should not generate frames at higher framerates 
       
   122      * than the recommendation. The movie may, however, exceed this
       
   123      * recommendation. For example, the framerate may be higher if the 
       
   124      * framerates of some of the video clips are higher than the 
       
   125      * recommendation and it is not possible to transcode them to reduce 
       
   126      * the framerate.
       
   127      *
       
   128      * @return  maximum framerate in frames per second
       
   129      */
       
   130     TInt MaximumFramerate() const;
       
   131 
       
   132     /**
       
   133      * Returns the audio type of the movie audio track.
       
   134      * 
       
   135      * @return  audio type of the movie audio track
       
   136      */
       
   137     TVedAudioType AudioType() const;
       
   138 
       
   139     /**
       
   140      * Returns the audio sampling rate of the movie audio track.
       
   141      *
       
   142      * @return  audio sampling rate of the movie audio track.
       
   143      */
       
   144     TInt AudioSamplingRate() const;
       
   145 
       
   146     /**
       
   147      * Sets the output parameters for the movie. Leaves
       
   148      * with KErrNotSupported if a parameter is illegal,
       
   149      * e.g., target bitrate is too high for the given 
       
   150      * codec. This method overrides the SetQuality method
       
   151      *
       
   152      * Possible leave codes:
       
   153      *  - <code>KErrNotSupported</code> if setting is not valid
       
   154      *
       
   155      * @param Output parameters
       
   156      */
       
   157     virtual void SetOutputParametersL(TVedOutputParameters& aOutputParams);
       
   158 
       
   159     /**
       
   160      * Returns the audio channel mode of the movie audio track.
       
   161      * 
       
   162      * @return  audio channel mode of the movie audio track.
       
   163      */
       
   164     TVedAudioChannelMode AudioChannelMode() const;
       
   165     
       
   166     /**
       
   167      * Returns the audio bitrate mode of the movie audio track.
       
   168      *
       
   169      * @return audio bitrate mode
       
   170      */
       
   171     TVedBitrateMode AudioBitrateMode() const;
       
   172 
       
   173     /**
       
   174      * Returns the target bitrate of the movie audio track.
       
   175      * 
       
   176      * @return  target bitrate of the movie audio track.
       
   177      */
       
   178     TInt AudioBitrate() const;
       
   179 
       
   180     /**
       
   181      * Returns the required bitrate of the movie video track.
       
   182      * If nonzero, indicates real target bitrate => requires transcoding
       
   183      * 
       
   184      * @return  Requested bitrate of the movie video track.
       
   185      */
       
   186     TInt VideoBitrate() const;
       
   187     
       
   188     /**
       
   189      * Returns the "standard" or default bitrate of the movie video track.
       
   190      * If input is something else, no transcoding is needed, but new content 
       
   191      * is encoded using this rate. If there is also requested bitrate, the values 
       
   192      * should be the same. The "standard" does not necessarily mean the bitrate
       
   193      * is from video coding standard, it can be, but it can be also something else,
       
   194      * depending on the product variant.
       
   195      * 
       
   196      * @return  Standard bitrate of the movie video track.
       
   197      */
       
   198     TInt VideoStandardBitrate() const;
       
   199 
       
   200     /**
       
   201      * Returns the target framerate of the movie video track.
       
   202      * 
       
   203      * @return  target framerate of the movie video track.
       
   204      */
       
   205     TReal VideoFrameRate() const;
       
   206 
       
   207     /**
       
   208      * Returns the total duration of this movie.
       
   209      * 
       
   210      * @return  duration in microseconds
       
   211      */
       
   212     inline TTimeIntervalMicroSeconds Duration() const;
       
   213 
       
   214     /**
       
   215      * Returns an estimate of the total size of this movie.
       
   216      * 
       
   217      * @return  size estimate in bytes
       
   218      */
       
   219     TInt GetSizeEstimateL() const;
       
   220 
       
   221     /**
       
   222      * Estimates end cutpoint with given target size and start cutpoint for current movie.
       
   223      *
       
   224      * @param aTargetSize  Target filesize for section indicated by aStartTime and aEndTime.
       
   225      * @param aStartTime   Start time for first frame included in cutted section. 
       
   226      * @param aEndTime     On return contains estimated end time with given start time and section target filesize.
       
   227      */
       
   228     void GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime);
       
   229 
       
   230     /**
       
   231      * Returns whether movie properties meet MMS compatibility
       
   232      * 
       
   233      * @return  ETrue if MMS compatible, else EFalse
       
   234      */
       
   235     TBool IsMovieMMSCompatible() const;
       
   236 
       
   237 
       
   238     /* Video clip management methods. */
       
   239 
       
   240     /**
       
   241      * Returns the number of video clips in this movie.
       
   242      *
       
   243      * @return  number of video clips
       
   244      */
       
   245     inline TInt VideoClipCount() const;
       
   246 
       
   247     /** 
       
   248      * Returns the video clip at the specified index. 
       
   249      * Used by underlying modules and friend classes. Not part of public API.
       
   250      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   251      *
       
   252      * @param aIndex  index
       
   253      *
       
   254      * @return  clip at the specified index.
       
   255      */ 
       
   256     CVedVideoClip* VideoClip(TInt aIndex) const;
       
   257 
       
   258     /** 
       
   259      * Inserts the specified video clip to the specified index in this movie. 
       
   260      * The observers are notified when the clip has been added or adding clip 
       
   261      * has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
       
   262      * if another add video or audio clip operation is already running.
       
   263      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   264      *
       
   265      * Possible leave codes:
       
   266      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   267      *
       
   268      * @param aFileName  file name of the clip to add
       
   269      * @param aIndex     index the clip should be inserted at
       
   270      */
       
   271     void InsertVideoClipL(const TDesC& aFileName, TInt aIndex);
       
   272 
       
   273 
       
   274     void InsertVideoClipL(CVedVideoClipGenerator& aGenerator, TBool aIsOwnedByVideoClip,
       
   275                           TInt aIndex);
       
   276 
       
   277     /** 
       
   278      * Removes the video clip at the specified index from this movie.
       
   279      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   280      *
       
   281      * @param aIndex  index of the clip to be removed
       
   282      */
       
   283     void RemoveVideoClip(TInt aIndex);
       
   284 
       
   285 
       
   286     /* Transition effect management methods. */
       
   287 
       
   288     /** 
       
   289      * Returns the start transition effect of this movie. Panics with 
       
   290      * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
       
   291      * in the movie.
       
   292      *
       
   293      * @return  start transition effect
       
   294      */ 
       
   295     TVedStartTransitionEffect StartTransitionEffect() const;
       
   296 
       
   297     /** 
       
   298      * Sets the start transition effect of this movie. Panics with 
       
   299      * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
       
   300      * in the movie.
       
   301      *
       
   302      * @param aEffect  start transition effect
       
   303      */ 
       
   304     void SetStartTransitionEffect(TVedStartTransitionEffect aEffect);
       
   305 
       
   306     /**
       
   307      * Returns the number of middle transition effects in this movie.
       
   308      * Note that this is the same as the number of video clips minus one.
       
   309      *
       
   310      * @return  number of middle transition effects
       
   311      */
       
   312     TInt MiddleTransitionEffectCount() const;
       
   313 
       
   314     /** 
       
   315      * Returns the middle transition effect at the specified index. 
       
   316      * Panics with code <code>USER-130</code> if the index is invalid.
       
   317      *
       
   318      * @param aIndex  index
       
   319      *
       
   320      * @return  middle transition effect at the specified index
       
   321      */ 
       
   322     TVedMiddleTransitionEffect MiddleTransitionEffect(TInt aIndex) const;
       
   323 
       
   324     /** 
       
   325      * Sets the middle transition effect at the specified index. 
       
   326      * Panics with code <code>USER-130</code> if the index is invalid.
       
   327      *
       
   328      * @param aEffect  middle transition effect
       
   329      * @param aIndex   index
       
   330      */ 
       
   331     void SetMiddleTransitionEffect(TVedMiddleTransitionEffect aEffect, TInt aIndex);
       
   332 
       
   333     /** 
       
   334      * Returns the end transition effect of this movie. Panics with 
       
   335      * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
       
   336      * in the movie.
       
   337      *
       
   338      * @return  end transition effect
       
   339      */ 
       
   340     TVedEndTransitionEffect EndTransitionEffect() const;
       
   341 
       
   342     /** 
       
   343      * Sets the end transition effect of this movie. Panics with 
       
   344      * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
       
   345      * in the movie.
       
   346      *
       
   347      * @param aEffect  end transition effect
       
   348      */ 
       
   349     void SetEndTransitionEffect(TVedEndTransitionEffect aEffect);
       
   350     
       
   351 
       
   352     /* Audio clip management methods. */
       
   353 
       
   354     /**
       
   355      * Returns the number of audio clips in this movie.
       
   356      *
       
   357      * @return  number of audio clips
       
   358      */
       
   359     TInt AudioClipCount() const;    
       
   360 
       
   361     /** 
       
   362      * Adds the specified audio clip to this movie. The observers are notified
       
   363      * when the clip has been added or adding clip has failed. Panics with 
       
   364      * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
       
   365      * audio clip operation is already running.
       
   366      * 
       
   367      * Possible leave codes:
       
   368      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   369      *
       
   370      * @param aFileName   file name of the clip to add
       
   371      * @param aStartTime  start time of the clip in movie timebase
       
   372      * @param aCutInTime  cut in time of the clip
       
   373      * @param aCutOutTime cut out time of the clip; or 
       
   374      *                    <code>KVedAudioClipOriginalDuration</code> to specify
       
   375      *                    that the original duration of the clip should be used
       
   376      */
       
   377     void AddAudioClipL(const TDesC& aFileName,
       
   378             TTimeIntervalMicroSeconds aStartTime,
       
   379             TTimeIntervalMicroSeconds aCutInTime,
       
   380             TTimeIntervalMicroSeconds aCutOutTime);
       
   381 
       
   382     /** 
       
   383      * Removes the audio clip at the specified index from this movie.
       
   384      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   385      *
       
   386      * @param aIndex  index of the clip to be removed
       
   387      */
       
   388     void RemoveAudioClip(TInt aIndex);
       
   389     
       
   390     
       
   391     /* Whole movie management methods. */
       
   392     
       
   393     /** 
       
   394      * Removes all video and audio clips and clears all transitions.
       
   395      */
       
   396     void Reset();
       
   397 
       
   398 
       
   399     /* Processing methods. */
       
   400 
       
   401     /**
       
   402      * Starts a video processing operation. This method is asynchronous and 
       
   403      * returns immediately. The processing will happen in the background and
       
   404      * the observer will be notified about the progress of the operation.
       
   405      * Processed data is written into the specified file. Panics with 
       
   406      * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
       
   407      * in the movie.
       
   408      * 
       
   409      * Possible leave codes:
       
   410      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   411      *  - <code>KErrAccessDenied</code> if the file access is denied
       
   412      *  - <code>KErrDiskFull</code> if the disk is full
       
   413      *  - <code>KErrWrite</code> if not all data could be written
       
   414      *  - <code>KErrBadName</code> if the filename is bad
       
   415      *  - <code>KErrDirFull</code> if the directory is full
       
   416      * 
       
   417      * @param aObserver  observer to be notified of the processing status
       
   418      * @param aFileName  name of the file to be written
       
   419      */
       
   420     void ProcessL(const TDesC& aFileName,
       
   421                            MVedMovieProcessingObserver& aObserver);
       
   422 
       
   423     /**
       
   424      * Cancels the current video processing operation. If there is no 
       
   425      * operation in progress, the function does nothing.
       
   426      */
       
   427     void CancelProcessing();
       
   428 
       
   429 
       
   430     /* Observer methods. */
       
   431 
       
   432     /**
       
   433      * Registers a movie observer. Panics with panic code 
       
   434      * <code>EMovieObserverAlreadyRegistered</code> if the movie observer is 
       
   435      * already registered.
       
   436      *
       
   437      * @param aObserver  observer that will receive the events
       
   438      */
       
   439     void RegisterMovieObserverL(MVedMovieObserver* aObserver);
       
   440 
       
   441     /**
       
   442      * Unregisters a movie observer.
       
   443      *
       
   444      * @param aObserver  observer to be unregistered
       
   445      */
       
   446     void UnregisterMovieObserver(MVedMovieObserver* aObserver);
       
   447 
       
   448     /* Video Clip Methods */
       
   449     /**
       
   450      * Returns a video clip info object to get detailed information about
       
   451      * the original video clip. Note that the specified editing operations 
       
   452      * (for example, cutting or muting audio) do <em>not</em>
       
   453      * affect the values returned by the info object.
       
   454      * 
       
   455      * @param aIndex  index of video clip in movie
       
   456      * @return  pointer to a video clip info instance
       
   457      */
       
   458     CVedVideoClipInfo* VideoClipInfo(TInt aIndex) const;
       
   459 
       
   460     /**
       
   461      * Returns whether this video clip with the specified editing operations 
       
   462      * applied (for example, changing speed or muting) has an audio track or not.
       
   463      *
       
   464      * @param aIndex  index of video clip in movie
       
   465      * @return  <code>ETrue</code> if clip has an audio track;
       
   466      *          <code>EFalse</code> otherwise
       
   467      */
       
   468     TBool VideoClipEditedHasAudio(TInt aIndex) const;
       
   469 
       
   470     /**
       
   471      * Sets the index of this video clip in the movie. 
       
   472      * Panics with code <code>EVideoClipIllegalIndex</code> 
       
   473      * if the clip index is invalid.
       
   474      *
       
   475      * @param aIndex  index of video clip in movie
       
   476      * @param aNewIndex  new index of this clip
       
   477      */
       
   478     void VideoClipSetIndex(TInt aOldIndex, TInt aNewIndex);
       
   479 
       
   480     /**
       
   481      * Returns the playback speed of this video clip. Playback speed is
       
   482      * specified as parts per thousand of the normal playback speed. For example.
       
   483      * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
       
   484      *
       
   485      * @param aIndex  index of video clip in movie
       
   486      * @return  playback speed
       
   487      */
       
   488     TInt VideoClipSpeed(TInt aIndex) const;
       
   489 
       
   490     /**
       
   491      * Sets the playback speed of this video clip. Playback speed is
       
   492      * specified as parts per thousand of the normal playback speed. For example.
       
   493      * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
       
   494      * Panics with <code>EVideoClipIllegalSpeed</code> if playback speed is
       
   495      * illegal.
       
   496      *
       
   497      * @param aIndex  index of video clip in movie
       
   498      * @param aSpeed  playback speed; must be between 1 and 1000
       
   499      */
       
   500     void VideoClipSetSpeed(TInt aIndex, TInt aSpeed);
       
   501 
       
   502     /**
       
   503      * Returns the color effect of this video clip.
       
   504      *
       
   505      * @param aIndex  index of video clip in movie
       
   506      * @return  color effect
       
   507      */
       
   508     TVedColorEffect VideoClipColorEffect(TInt aIndex) const;
       
   509     
       
   510     /**
       
   511      * Sets the color effect of this video clip.
       
   512      *
       
   513      * @param aIndex  index of video clip in movie
       
   514      * @param aColorEffect  color effect
       
   515      */
       
   516     void VideoClipSetColorEffect(TInt aIndex, TVedColorEffect aColorEffect);
       
   517 
       
   518     /**
       
   519      * Returns whether this video clip can be muted or not (that is,
       
   520      * whether the mute setting has any effect). For example, if
       
   521      * this video clip has no audio track, it can never have audio
       
   522      * even if the mute setting is false.
       
   523      *
       
   524      * @param aIndex  index of video clip in movie
       
   525      * @return  <code>ETrue</code> if this video clip can be muted;
       
   526      *          <code>EFalse</code> otherwise
       
   527      */
       
   528     TBool VideoClipIsMuteable(TInt aIndex) const;
       
   529 
       
   530     /**
       
   531      * Returns whether the audio track of this video clip is muted or not.
       
   532      *
       
   533      * @param aIndex  index of video clip in movie
       
   534      * @return  <code>ETrue</code> if the audio track is muted;
       
   535      *          <code>EFalse</code> otherwise
       
   536      */
       
   537     TBool VideoClipIsMuted(TInt aIndex) const;
       
   538 
       
   539     /**
       
   540      * Sets whether the audio track of this video clip is muted or not.
       
   541      *
       
   542      * @param aIndex  index of video clip in movie
       
   543      * @param aVolume  <code>ETrue</code> to mute the audio track;
       
   544      *                 <code>EFalse</code> not to mute the audio track
       
   545      */
       
   546     void VideoClipSetMuted(TInt aIndex, TBool aMuted);
       
   547 
       
   548     /**
       
   549      * Returns whether the audio track of this video clip is normalized or not.
       
   550      *
       
   551      * @param aIndex  index of video clip in movie
       
   552      * @return  <code>ETrue</code> if the audio track is normalized;
       
   553      *          <code>EFalse</code> otherwise
       
   554      */
       
   555     TBool VideoClipNormalizing(TInt aIndex) const;
       
   556 
       
   557     /**
       
   558      * Sets whether the audio track of this video clip is normalized or not.
       
   559      *
       
   560      * @param aIndex  index of video clip in movie
       
   561      * @param aVolume  <code>ETrue</code> to normalize the audio track;
       
   562      *                 <code>EFalse</code> not to normalize the audio track
       
   563      */
       
   564     void VideoClipSetNormalizing(TInt aIndex, TBool aNormalizing);
       
   565 
       
   566     /**
       
   567      * Inserts a new dynamic level mark to the video clip. The mark timing
       
   568      * must be within the time boundaries of the video clip.
       
   569      *
       
   570      * @param aIndex  index of the video clip
       
   571      * @param aMark   dynamic level mark to be inserted
       
   572      */
       
   573     void VideoClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark);
       
   574     
       
   575     /**
       
   576      * Removes the specified dynamic level mark from the specified video clip.
       
   577      * The mark index must be between 0 and number of dynamic level marks in the clip.
       
   578      *
       
   579      * @param aClipIndex  index of the video clip
       
   580      * @param aMarkIndex  index of the mark to be removed
       
   581      */
       
   582     void VideoClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
       
   583 
       
   584     /**
       
   585      * Returns the number of dynamic level marks in the specified video clip.
       
   586      * 
       
   587      * @param aIndex  index of the video clip
       
   588      */
       
   589     TInt VideoClipDynamicLevelMarkCount(TInt aIndex) const;
       
   590 
       
   591     /**
       
   592      * Returns the specified dynamic level mark from the specified video clip.
       
   593      * 
       
   594      * @param aClipIndex  index of the video clip
       
   595      * @param aMarkIndex  index of the dynamic level mark
       
   596      */    
       
   597     TVedDynamicLevelMark VideoClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
       
   598 
       
   599     /**
       
   600      * Returns the cut in time of this video clip in clip timebase.
       
   601      *
       
   602      * @param aIndex  index of video clip in movie
       
   603      * @return  cut in time in microseconds in clip timebase
       
   604      */
       
   605     TTimeIntervalMicroSeconds VideoClipCutInTime(TInt aIndex) const;
       
   606 
       
   607     /**
       
   608      * Sets the cut in time of this video clip in clip timebase.
       
   609      * Panics with <code>EVideoClipIllegalCutInTime</code> if
       
   610      * cut in time is illegal.
       
   611      *
       
   612      * @param aIndex  index of video clip in movie
       
   613      * @param aCutInTime  cut in time in microseconds in clip timebase
       
   614      */
       
   615     void VideoClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime);
       
   616 
       
   617     /**
       
   618      * Returns the cut out time of this video clip in clip timebase.
       
   619      *
       
   620      * @return  cut out time in microseconds in clip timebase
       
   621      */
       
   622     TTimeIntervalMicroSeconds VideoClipCutOutTime(TInt aIndex) const;
       
   623 
       
   624     /**
       
   625      * Sets the cut out time of this video clip in clip timebase. 
       
   626      * Panics with <code>EVideoClipIllegalCutOutTime</code> if
       
   627      * cut out time is illegal.
       
   628      *
       
   629      * @param aIndex  index of video clip in movie
       
   630      * @param aCutOutTime  cut out time in microseconds in clip timebase
       
   631      */
       
   632     void VideoClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime);
       
   633 
       
   634     /**
       
   635      * Returns the start time of this video clip in movie timebase.
       
   636      *
       
   637      * @param aIndex  index of video clip in movie
       
   638      * @return  start time in microseconds in movie timebase
       
   639      */
       
   640     TTimeIntervalMicroSeconds VideoClipStartTime(TInt aIndex) const;
       
   641 
       
   642     /**
       
   643      * Returns the end time of this video clip in movie timebase.
       
   644      *
       
   645      * @param aIndex  index of video clip in movie
       
   646      * @return  end time in microseconds in movie timebase
       
   647      */
       
   648     TTimeIntervalMicroSeconds VideoClipEndTime(TInt aIndex) const;
       
   649 
       
   650     /**
       
   651      * Returns the duration of this video clip with the specified
       
   652      * editing operations applied (for example, cutting 
       
   653      * and changing speed)
       
   654      * 
       
   655      * @param aIndex  index of video clip in movie
       
   656      * @return  duration in microseconds
       
   657      */
       
   658     TTimeIntervalMicroSeconds VideoClipEditedDuration(TInt aIndex) const;
       
   659 
       
   660     /* Audio Clip Methods */
       
   661     /**
       
   662      * Returns an audio clip info object to get detailed information about
       
   663      * the original audio clip. Note that the specified editing operations 
       
   664      * (for example, changing duration) do <em>not</em>
       
   665      * affect the values returned by the info object.
       
   666      * 
       
   667      * @param aIndex  index of audio clip in movie
       
   668      * @return  pointer to an audio clip info instance
       
   669      */
       
   670     CVedAudioClipInfo* AudioClipInfo(TInt aIndex) const;
       
   671 
       
   672     /**
       
   673      * Returns the start time of this audio clip in movie timebase.
       
   674      *
       
   675      * @param aIndex  index of audio clip in movie
       
   676      * @return  start time in microseconds in movie timebase
       
   677      */
       
   678     TTimeIntervalMicroSeconds AudioClipStartTime(TInt aIndex) const;
       
   679 
       
   680     /**
       
   681      * Sets the start time of this audio clip in movie timebase. 
       
   682      * Also updates the end time. Duration remains unchanged.
       
   683      * Note that since the audio clips are ordered based on their
       
   684      * start times, the index of the clip may change as a result
       
   685      * of changing the start time.
       
   686      *
       
   687      * @param aIndex  index of audio clip in movie
       
   688      * @param aStartTime  start time in microseconds in movie timebase
       
   689      */
       
   690     void AudioClipSetStartTime(TInt aIndex, TTimeIntervalMicroSeconds aStartTime);
       
   691 
       
   692     /**
       
   693      * Returns the end time of this audio clip in movie timebase.
       
   694      *
       
   695      * @param aIndex  index of audio clip in movie
       
   696      * @return  end time in microseconds in movie timebase
       
   697      */
       
   698     TTimeIntervalMicroSeconds AudioClipEndTime(TInt aIndex) const;
       
   699 
       
   700     /**
       
   701      * Returns the duration of the selected part of this clip.
       
   702      * 
       
   703      * @param aIndex  index of audio clip in movie
       
   704      * @return  duration in microseconds
       
   705      */
       
   706     TTimeIntervalMicroSeconds AudioClipEditedDuration(TInt aIndex) const;
       
   707 
       
   708     /**
       
   709      * Returns the cut in time of this audio clip in clip timebase.
       
   710      *
       
   711      * @param aIndex  index of audio clip in movie
       
   712      * @return  cut in time in microseconds in clip timebase
       
   713      */
       
   714     TTimeIntervalMicroSeconds AudioClipCutInTime(TInt aIndex) const;
       
   715 
       
   716     /**
       
   717      * Sets the cut in time of this audio clip in clip timebase.
       
   718      * Panics with <code>EAudioClipIllegalCutInTime</code> if
       
   719      * cut in time is illegal.
       
   720      *
       
   721      * @param aIndex  index of audio clip in movie
       
   722      * @param aCutInTime  cut in time in microseconds in clip timebase
       
   723      */
       
   724     void AudioClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime);
       
   725 
       
   726     /**
       
   727      * Returns the cut out time of this audio clip in clip timebase.
       
   728      *
       
   729      * @param aIndex  index of audio clip in movie
       
   730      * @return  cut out time in microseconds in clip timebase
       
   731      */
       
   732     TTimeIntervalMicroSeconds AudioClipCutOutTime(TInt aIndex) const;
       
   733 
       
   734     /**
       
   735      * Sets the cut out time of this audio clip in clip timebase.
       
   736      * Panics with <code>EAudioClipIllegalCutOutTime</code> if
       
   737      * cut in time is illegal.
       
   738      *
       
   739      * @param aIndex  index of audio clip in movie
       
   740      * @param aCutOutTime  cut out time in microseconds in clip timebase
       
   741      */
       
   742     void AudioClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime);
       
   743 
       
   744     /**
       
   745      * Returns whether this audio clip is normalized or not.
       
   746      *
       
   747      * @param aIndex  index of audio clip in movie
       
   748      * @return  <code>ETrue</code> if the audio clip is normalized;
       
   749      *          <code>EFalse</code> otherwise
       
   750      */
       
   751     TBool AudioClipNormalizing(TInt aIndex) const;
       
   752 
       
   753     /**
       
   754      * Sets whether this audio clip is normalized or not.
       
   755      *
       
   756      * @param aIndex  index of audio clip in movie
       
   757      * @param aVolume  <code>ETrue</code> to normalize the audio clip;
       
   758      *                 <code>EFalse</code> not to normalize the audio clip
       
   759      */
       
   760     void AudioClipSetNormalizing(TInt aIndex, TBool aNormalizing);
       
   761     
       
   762     /**
       
   763      * Inserts a new dynamic level mark to the audio clip. The mark timing
       
   764      * must be within the time boundaries of the audio clip.
       
   765      *
       
   766      * @param aIndex  index of the audio clip
       
   767      * @param aMark   dynamic level mark to be inserted
       
   768      */
       
   769     void AudioClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark);
       
   770     
       
   771     /**
       
   772      * Removes the specified dynamic level mark from the specified audio clip.
       
   773      * The mark index must be between 0 and number of dynamic level marks in the clip.
       
   774      *
       
   775      * @param aClipIndex  index of the audio clip
       
   776      * @param aMarkIndex  index of the mark to be removed
       
   777      */
       
   778     void AudioClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
       
   779 
       
   780     /**
       
   781      * Returns the number of dynamic level marks in the specified audio clip.
       
   782      * 
       
   783      * @param aIndex  index of the audio clip
       
   784      */
       
   785     TInt AudioClipDynamicLevelMarkCount(TInt aIndex) const;
       
   786 
       
   787     /**
       
   788      * Returns the specified dynamic level mark from the specified audio clip.
       
   789      * 
       
   790      * @param aClipIndex  index of the audio clip
       
   791      * @param aMarkIndex  index of the dynamic level mark
       
   792      */    
       
   793     TVedDynamicLevelMark AudioClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
       
   794     
       
   795     /**
       
   796      * Returns the color tone of the specified clip.
       
   797      *
       
   798      * @return color tone
       
   799      */
       
   800     TRgb VideoClipColorTone(TInt aVideoCLipIndex) const;
       
   801     
       
   802     /**
       
   803      * Sets the color tone of the specified clip.
       
   804      *
       
   805      * @param aColorTone  color tone
       
   806      */
       
   807     void VideoClipSetColorTone(TInt aVideoClipIndex, TRgb aColorTone);
       
   808     
       
   809     /**
       
   810      * Returns a pointer to the audio song used as the sound provider for
       
   811      * this movie.
       
   812      * 
       
   813      * @return  song
       
   814      */
       
   815     CAudSong* Song();
       
   816     
       
   817     /**
       
   818      * Sets the maximum size for the movie
       
   819      * 
       
   820      * @param aLimit Maximum size in bytes
       
   821      */
       
   822     virtual void SetMovieSizeLimit(TInt aLimit);
       
   823     
       
   824     /**
       
   825      * Returns an estimate for total processing time
       
   826      * 
       
   827      * @return processing time
       
   828      */
       
   829     TTimeIntervalMicroSeconds GetProcessingTimeEstimateL();
       
   830     
       
   831     /**
       
   832      * Returns the MIME-type for the video in the movie
       
   833      * 
       
   834      * @return Video codec MIME-type
       
   835      */
       
   836     TPtrC8& VideoCodecMimeType();
       
   837     /**
       
   838     * Gets the sync interval in picture (H.263 GOB frequency)
       
   839     * 
       
   840     * @return sync interval 
       
   841     */
       
   842     TInt SyncIntervalInPicture();
       
   843     
       
   844     /**
       
   845     * Gets the random access rate
       
   846     * 
       
   847     * @return random access rate in pictures per second
       
   848     */
       
   849     TReal RandomAccessRate();
       
   850     
       
   851     /**
       
   852      * Checks if a movie observer is registered.
       
   853      *
       
   854      * @param aObserver observer to be checked
       
   855      * @return <code>ETrue</code> if the observer is registered
       
   856      *         <code>EFalse</code> otherwise
       
   857      */
       
   858     TBool MovieObserverIsRegistered(MVedMovieObserver* aObserver);
       
   859 
       
   860     /**
       
   861     * Set volume gain for the given video clip or all the video clips
       
   862     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
       
   863     * @param aVolumeGain   Volume gain in +0.1 or -0.5 decibel steps
       
   864     * 
       
   865     */
       
   866     void SetVideoClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain);
       
   867 
       
   868     /**
       
   869     * Get volume gain of the given video clip or all the video clips
       
   870     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
       
   871     *
       
   872     * @return Volume gain in +0.1 or -0.5 decibel steps
       
   873     */
       
   874     TInt GetVideoClipVolumeGainL(TInt aClipIndex);
       
   875 
       
   876     /**
       
   877     * Set volume gain for the given audio clip or all the audio clips
       
   878     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
       
   879     * @param aVolumeGain   Volume gain in +0.1 or -0.5 decibel steps 
       
   880     * 
       
   881     */
       
   882     void SetAudioClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain);
       
   883 
       
   884     /**
       
   885     * Get volume gain of the given audio clip or all the audio clips
       
   886     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
       
   887     *
       
   888     * @return Volume gain in +0.1 or -0.5 decibel steps
       
   889     */
       
   890     TInt GetAudioClipVolumeGainL(TInt aClipIndex);
       
   891     
       
   892     /** 
       
   893      * Inserts a video clip from the specified file to the specified index 
       
   894      * in this movie. The observers are notified when the clip has been added 
       
   895      * or adding clip has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
       
   896      * if another add video or audio clip operation is already running.
       
   897      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   898      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   899      * and the same mode should be used by the client too if it need to open
       
   900      * the file at the same time.
       
   901      *  
       
   902      * Possible leave codes:
       
   903      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   904      *
       
   905      * @param aFileHandle  file handle of the clip to add
       
   906      * @param aIndex     index the clip should be inserted at
       
   907      */    
       
   908     void InsertVideoClipL(RFile* aFileHandle, TInt aIndex);
       
   909     
       
   910     /** 
       
   911      * Adds the specified audio clip to this movie. The observers are notified
       
   912      * when the clip has been added or adding clip has failed. Panics with 
       
   913      * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
       
   914      * audio clip operation is already running.
       
   915      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   916      * and the same mode should be used by the client too if it need to open
       
   917      * the file at the same time.
       
   918      * 
       
   919      * Possible leave codes:
       
   920      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   921      *
       
   922      * @param aFilehandle   file handle of the clip to add
       
   923      * @param aStartTime  start time of the clip in movie timebase
       
   924      * @param aCutInTime  cut in time of the clip
       
   925      * @param aCutOutTime cut out time of the clip; or 
       
   926      *                    <code>KVedAudioClipOriginalDuration</code> to specify
       
   927      *                    that the original duration of the clip should be used
       
   928      */    
       
   929     void AddAudioClipL(RFile* aFileHandle,
       
   930             TTimeIntervalMicroSeconds aStartTime,
       
   931             TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
       
   932             TTimeIntervalMicroSeconds aCutOutTime = KVedAudioClipOriginalDuration);
       
   933     
       
   934      
       
   935     /**
       
   936      * Starts a video processing operation. This method is asynchronous and 
       
   937      * returns immediately. The processing will happen in the background and
       
   938      * the observer will be notified about the progress of the operation.
       
   939      * Processed data is written into the specified file. Panics with 
       
   940      * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
       
   941      * in the movie. Note that calling <code>ProcessL</code> may cause
       
   942      * changes in the maximum frame rates of generated clips.
       
   943      * 
       
   944      * Possible leave codes:
       
   945      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   946      *  - <code>KErrAccessDenied</code> if the file access is denied
       
   947      *  - <code>KErrDiskFull</code> if the disk is full
       
   948      *  - <code>KErrWrite</code> if not all data could be written
       
   949      *  - <code>KErrBadName</code> if the filename is bad
       
   950      *  - <code>KErrDirFull</code> if the directory is full
       
   951      * 
       
   952      * @param aObserver  observer to be notified of the processing status
       
   953      * @param aFileHandle  handle of the file to be written
       
   954      */
       
   955     void ProcessL(RFile* aFileHandle,
       
   956                            MVedMovieProcessingObserver& aObserver);
       
   957 
       
   958 private:
       
   959     /* Movie editing methods. */
       
   960 
       
   961     /**
       
   962      * Match the selected audio properties with input. This is used with automatic
       
   963      * quality to avoid useless transcoding of audio. 
       
   964      */
       
   965     TBool MatchAudioPropertiesWithInput( TAudFileProperties& aAudioProperties );
       
   966 
       
   967     /**
       
   968      * Calculates the format, video type, resolution and audio type of 
       
   969      * this movie. 
       
   970      */
       
   971     void CalculatePropertiesL();
       
   972 
       
   973     /**
       
   974      * Determines the output format based on input and sets up the movie accordingly
       
   975      */
       
   976     void ApplyAutomaticPropertiesL(TAudFileProperties &aAudioProperties);
       
   977     
       
   978     /**
       
   979      * Sets up the movie according to requested properties
       
   980      */
       
   981     void ApplyRequestedPropertiesL(TAudFileProperties &aAudioProperties);
       
   982     
       
   983     /**
       
   984      * Get properties for QCIF/subQCIF from quality set and sets up video
       
   985      */
       
   986     TInt GetQCIFPropertiesL(SVideoQualitySet& aLocalQualitySet);
       
   987     
       
   988     /**
       
   989      * Get properties for CIF/QVGA from quality set and sets up video
       
   990      */
       
   991     TInt GetCIFQVGAPropertiesL(TSize aSize, TReal aFrameRate, SVideoQualitySet& aLocalQualitySet);
       
   992     
       
   993     /**
       
   994      * Get properties for VGA from quality set and sets up video
       
   995      */
       
   996     TInt GetVGAPropertiesL(SVideoQualitySet& aLocalQualitySet);
       
   997     
       
   998     /**
       
   999      * Get properties for VGA 16:9 from quality set and sets up video
       
  1000      */
       
  1001     TInt GetVGA16By9PropertiesL(SVideoQualitySet& aLocalQualitySet);
       
  1002     
       
  1003     /**
       
  1004     * Get properties for VGA from quality set and sets up video
       
  1005     */
       
  1006     TInt GetWVGAPropertiesL(SVideoQualitySet& aLocalQualitySet);
       
  1007     
       
  1008     /**
       
  1009      * Get properties for high quality from quality set
       
  1010      */
       
  1011     TInt GetHighPropertiesL(SVideoQualitySet& aLocalQualitySet);
       
  1012     
       
  1013     /**
       
  1014      * Creates temporary instance of CTRTranscoder and asks for complexity factor estimate
       
  1015      * when converting given video clip to movie with set parameters.
       
  1016      * The estimate represents how long processing of 1 sec input takes.
       
  1017      */
       
  1018     TReal AskComplexityFactorFromTranscoderL(CVedVideoClipInfo* aInfo, CTRTranscoder::TTROperationalMode aMode, TReal aInputFrameRate);
       
  1019     
       
  1020     /**
       
  1021      * Checks whether the specified video clip can be inserted to this movie.
       
  1022      *
       
  1023      * @param aClip  video clip
       
  1024      *
       
  1025      * @return  <code>KErrNone</code>, if the clip can be inserted; 
       
  1026      *          one of the system wide error codes, otherwise
       
  1027      */
       
  1028     TInt CheckVideoClipInsertable(CVedVideoClip *aClip) const;
       
  1029 
       
  1030     /**
       
  1031      * Calculates the maximum and minimum resolution supported by this movie.
       
  1032      *
       
  1033      * @param aMaxRes       initial upper limit for the maximum resolution; 
       
  1034      *                      after the method returns, contains the calculated
       
  1035      *                      maximum resolution supported by this movie
       
  1036      * @param aMinRes       initial lower limit for the minimum resolution; 
       
  1037      *                      after the method returns, contains the calculated
       
  1038      *                      minimum resolution supported by this movie
       
  1039      * @param aDoFullCheck  <code>ETrue</code>, if all clips should be
       
  1040      *                      checked to verify that they can be combined
       
  1041      *                      (not necessary but useful for detecting internal 
       
  1042      *                      errors); <code>EFalse</code>, if extra checks 
       
  1043      *                      should be skipped to minimize execution time
       
  1044      */
       
  1045     void CalculateMaxAndMinResolution(TSize& aMaxRes, TSize& aMinRes,
       
  1046                                       TBool aDoFullCheck) const;
       
  1047 
       
  1048     /**
       
  1049      * Recalculates video clip timings.
       
  1050      *
       
  1051      * @param aVideoClip  Video clip
       
  1052      */
       
  1053     void RecalculateVideoClipTimings(CVedVideoClip* aVideoClip);    
       
  1054 
       
  1055     /**
       
  1056      * Reset the movie. 
       
  1057      */
       
  1058     void DoReset();
       
  1059     
       
  1060     /**
       
  1061      * Set audio fade in/out on clip boundaries
       
  1062      */
       
  1063     void SetAudioFadingL();
       
  1064     
       
  1065     /**
       
  1066      * Internal helper function to set iVideoCodecMimeType to given value
       
  1067      */
       
  1068     void SetVideoCodecMimeType(const TText8* aVideoCodecType);
       
  1069 
       
  1070     /* Notification methods. */
       
  1071 
       
  1072     /**
       
  1073      * Notify observers that the video clip has been added to movie.
       
  1074      *
       
  1075      * @param aMovie This movie.
       
  1076      * @param aClip Added video clip.
       
  1077      */
       
  1078     void FireVideoClipAdded(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1079 
       
  1080     /**
       
  1081      * Notify observers that the adding of video clip failed.
       
  1082      *
       
  1083      * @param 
       
  1084      */
       
  1085     void FireVideoClipAddingFailed(CVedMovie* aMovie, TInt aError);
       
  1086 
       
  1087     /**
       
  1088      * Notify observers that the video clip has been removed from movie.
       
  1089      *
       
  1090      * @param aMovie This movie.
       
  1091      * @param aIndex Index of removed video clip.
       
  1092      */
       
  1093     void FireVideoClipRemoved(CVedMovie* aMovie, TInt aIndex);
       
  1094 
       
  1095     /**
       
  1096      * Notify observers that the video clip indices has changes.
       
  1097      *
       
  1098      * @param aMovie This movie.
       
  1099      * @param aOldIndex Old index of video clip.
       
  1100      * @param aNewIndex New index of video clip.
       
  1101      */
       
  1102     void FireVideoClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, 
       
  1103                                      TInt aNewIndex);
       
  1104 
       
  1105     /**
       
  1106      * Notify observers that the video clip timings has been changed.
       
  1107      *
       
  1108      * @param aMovie This movie.
       
  1109      * @param aClip The video clip.
       
  1110      */
       
  1111     void FireVideoClipTimingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1112 
       
  1113     /**
       
  1114      * Notify observers that the color effect of video clip has been changed.
       
  1115      *
       
  1116      * @param aMovie This movie.
       
  1117      * @param aClip Video clip that was changed.
       
  1118      */
       
  1119     void FireVideoClipColorEffectChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1120 
       
  1121     /**
       
  1122      * Notify observers that the audio settings of video clip has been changed.
       
  1123      *
       
  1124      * @param aMovie This movie.
       
  1125      * @param aClip Video clip that audio settings has been changed.
       
  1126      */
       
  1127     void FireVideoClipAudioSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1128 
       
  1129     /**
       
  1130      * Notify observers that the generator settings of video clip has been changed.
       
  1131      *
       
  1132      * @param aMovie This movie.
       
  1133      * @param aClip  Video clip whose settings has been changed
       
  1134      */
       
  1135     void FireVideoClipGeneratorSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1136 
       
  1137     /**
       
  1138      * Notify observers that the descriptive name of video clip has been changed.
       
  1139      *
       
  1140      * @param aMovie  This movie
       
  1141      * @param aClip   Video clip whose settings has been changed
       
  1142      */
       
  1143     void FireVideoClipDescriptiveNameChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
       
  1144 
       
  1145 
       
  1146     /**
       
  1147      * Notify observers that the start transition effect of the movie has been changed.
       
  1148      *
       
  1149      * @param aMovie This movie.
       
  1150      */
       
  1151     void FireStartTransitionEffectChanged(CVedMovie* aMovie);
       
  1152 
       
  1153     /**
       
  1154      * Notify observers that the middle transition effect of video clip has been changed.
       
  1155      *
       
  1156      * @param aMovie This movie.
       
  1157      * @param aClip Video clip that was changed.
       
  1158      */
       
  1159     void FireMiddleTransitionEffectChanged(CVedMovie* aMovie, TInt aIndex);
       
  1160 
       
  1161     /**
       
  1162      * Notify observers that the end transition effect of the movie has been changed.
       
  1163      *
       
  1164      * @param aMovie This movie.
       
  1165      */
       
  1166     void FireEndTransitionEffectChanged(CVedMovie* aMovie);
       
  1167 
       
  1168     /**
       
  1169      * Notify observers that an audio clip has been added to movie.
       
  1170      *
       
  1171      * @param aMovie This movie.
       
  1172      * @param aIndex index of added clip.
       
  1173      */
       
  1174     void FireAudioClipAdded(CVedMovie* aMovie, TInt aIndex);
       
  1175 
       
  1176     /**
       
  1177      * Notify observers that the adding of audio clip has failed.
       
  1178      *
       
  1179      * @param aMovie This movie.
       
  1180      * @param aError Error code.
       
  1181      */
       
  1182     void FireAudioClipAddingFailed(CVedMovie* aMovie, TInt aError);
       
  1183 
       
  1184     /**
       
  1185      * Notify observers that the audio clip has been removed from movie. 
       
  1186      *
       
  1187      * @param aMovie This movie.
       
  1188      * @param aInder Index of removed audio clip.
       
  1189      */
       
  1190     void FireAudioClipRemoved(CVedMovie* aMovie, TInt aIndex);
       
  1191 
       
  1192     /**
       
  1193      * Notify observers that the audio clip indices has been changed.
       
  1194      *
       
  1195      * @param aMovie This movie.
       
  1196      * @param aOldIndex Old index of the audio clip.
       
  1197      * @param aNewIndex New index of the audio clip.
       
  1198      */
       
  1199     void FireAudioClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, TInt aNewIndex);
       
  1200 
       
  1201     /**
       
  1202      * Notify observers that the audio clip timings has been changed.
       
  1203      *
       
  1204      * @param aMovie This movie.
       
  1205      * @param aClip The audio clip that timings has been changed.
       
  1206      */
       
  1207     void FireAudioClipTimingsChanged(CVedMovie* aMovie, CAudClip* aClip);
       
  1208 
       
  1209     /**
       
  1210      * Notify observers that output parameters has been changed.
       
  1211      *
       
  1212      * @param aMovie This movie.
       
  1213      * @param aClip The audio clip that timings has been changed.
       
  1214      */
       
  1215     void FireMovieOutputParametersChanged(CVedMovie* aMovie);
       
  1216 
       
  1217     /**
       
  1218      * Notify observers that an audio or video clip dynamic level
       
  1219      * mark has been removed.
       
  1220      *
       
  1221      * @param aClip   The audio clip that timings has been changed.
       
  1222      * @param aIndex  Index of the removed dynamic level mark
       
  1223      */
       
  1224     void FireDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex);
       
  1225 
       
  1226     /**
       
  1227      * Notify observers that an audio or video clip dynamic level
       
  1228      * mark has been inserted.
       
  1229      *
       
  1230      * @param aClip   The audio clip that timings has been changed.
       
  1231      * @param aMark   Dynamic level mark that was inserted
       
  1232      * @param aIndex  Index of the removed dynamic level mark
       
  1233      */
       
  1234     void FireDynamicLevelMarkInserted(CAudClip& aClip, TAudDynamicLevelMark& aMark, TInt aIndex);
       
  1235 
       
  1236     /**
       
  1237      * Notify observers that the quality setting of the movie has been
       
  1238      * changed.
       
  1239      *
       
  1240      * @param aMovie This movie.
       
  1241      */
       
  1242     void FireMovieQualityChanged(CVedMovie* aMovie);
       
  1243 
       
  1244     /**
       
  1245      * Notify observers that the movie has been reseted.
       
  1246      *
       
  1247      * @param aMovie This movie.
       
  1248      */
       
  1249     void FireMovieReseted(CVedMovie* aMovie);    
       
  1250 
       
  1251 private: // methods from base classes
       
  1252     void NotifyClipAdded(CAudSong& aSong, CAudClip& aClip, 
       
  1253         TInt aIndex, TInt aTrackIndex);
       
  1254     void NotifyClipAddingFailed(CAudSong& aSong, TInt aError, TInt aTrackIndex);
       
  1255     void NotifyClipRemoved(CAudSong& aSong, TInt aIndex, TInt aTrackIndex);
       
  1256     void NotifyClipTimingsChanged(CAudSong& aSong, CAudClip& aClip);
       
  1257     void NotifyClipIndicesChanged(CAudSong& aSong, TInt aOldIndex, 
       
  1258         TInt aNewIndex, TInt aTrackIndex);
       
  1259     void NotifySongReseted(CAudSong& aSong);
       
  1260     void NotifyClipReseted(CAudClip& aClip);
       
  1261     void NotifyDynamicLevelMarkInserted(CAudClip& aClip, 
       
  1262         TAudDynamicLevelMark& aMark, TInt aIndex);
       
  1263     void NotifyDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex);
       
  1264     
       
  1265     void NotifyAudioClipInfoReady(CVedAudioClipInfo& aInfo, TInt aError);
       
  1266 
       
  1267 private:
       
  1268     // Member variables
       
  1269 
       
  1270     // File server session.
       
  1271     RFs* iFs;
       
  1272     // Video clip array.
       
  1273     RPointerArray<CVedVideoClip> iVideoClipArray;
       
  1274     // Audio clip array.
       
  1275     RPointerArray<CVedAudioClipInfoImp> iAudioClipInfoArray;
       
  1276     // Observer array of the movie class.
       
  1277     RPointerArray<MVedMovieObserver> iObserverArray;
       
  1278 
       
  1279     // Start transition effect of the movie.
       
  1280     TVedStartTransitionEffect iStartTransitionEffect;
       
  1281     // End transition effect of the movie.
       
  1282     TVedEndTransitionEffect iEndTransitionEffect;
       
  1283     
       
  1284     // Add clip operation for movie.    
       
  1285     CVedMovieAddClipOperation* iAddOperation;
       
  1286     // Video editor processor.
       
  1287     CMovieProcessor* iProcessor;
       
  1288 
       
  1289     // Quality
       
  1290     TVedMovieQuality iQuality;
       
  1291     // Format.
       
  1292     TVedVideoFormat iFormat;
       
  1293     // Quality set assigned for the movie
       
  1294     SVideoQualitySet iQualitySet;
       
  1295     // Video type, both internal enum and MIME-type.
       
  1296     TVedVideoType iVideoType;
       
  1297     TPtrC8 iVideoCodecMimeType;
       
  1298     // Resolution.
       
  1299     TSize iResolution;
       
  1300     // Maximum framerate.
       
  1301     TInt iMaximumFramerate;
       
  1302     // Random access point rate, in pictures per second.
       
  1303     TReal iRandomAccessRate;
       
  1304     // Standard video bitrate; can be used when encoding, but doesn't force to transcode input to this bitrate
       
  1305     TInt iVideoStandardBitrate;
       
  1306         
       
  1307     // Used when non-zero
       
  1308     TInt iVideoRestrictedBitrate;    
       
  1309     TReal iVideoFrameRate;    
       
  1310     // Segment interval in picture. In H.263 baseline this means number of non-empty GOB headers (1=every GOB has a header), 
       
  1311     // in MB-based systems number of MBs per segment. Default is 0 == no segments inside picture
       
  1312     // Coding standard & used profile etc. limit the value.
       
  1313     TInt iSyncIntervalInPicture;
       
  1314     // Latest estimate for processing time of the movie
       
  1315     TTimeIntervalMicroSeconds iEstimatedProcessingTime;
       
  1316         
       
  1317     // Song
       
  1318     CAudSong* iAudSong;
       
  1319     
       
  1320     // Whether output parameters have been set using SetOutputParametersL
       
  1321     TBool iOutputParamsSet;
       
  1322     
       
  1323     // Video clip index stored for inserting video clip first to AudSong, then to Movie
       
  1324     TInt iAddedVideoClipIndex;
       
  1325     
       
  1326     // File name of the added clip
       
  1327     HBufC* iAddedVideoClipFilename;            
       
  1328     
       
  1329     RFile* iAddedVideoClipFileHandle;
       
  1330     
       
  1331     // whether to notify observer about dynamic
       
  1332     // level marker changes
       
  1333     TBool iNotifyObserver;
       
  1334     
       
  1335     // Codec availability checker 
       
  1336     CVedCodecChecker* iCodecChecker;
       
  1337 
       
  1338     // Volume gains for all video and audio clips
       
  1339     TInt iVolumeGainForAllVideoClips;
       
  1340     TInt iVolumeGainForAllAudioClips;
       
  1341     
       
  1342     // ETrue if specific dynamic level mark(s) or global volume settings should be applied (EFalse)
       
  1343     TBool iApplyDynamicLevelMark;
       
  1344     
       
  1345     // Quality settings manager
       
  1346     CVideoQualitySelector* iQualitySelector;
       
  1347     
       
  1348     MVedMovieProcessingObserver* iMovieProcessingObserver;
       
  1349     
       
  1350     friend class CVedMovieAddClipOperation;
       
  1351     friend class CVedVideoClip;
       
  1352     friend class CVedAudioClip;
       
  1353     friend class CVedVideoClipGenerator;
       
  1354     };
       
  1355 
       
  1356 
       
  1357 /**
       
  1358  * Internal class for adding video and audio clips.
       
  1359  */
       
  1360 class CVedMovieAddClipOperation : public CActive, 
       
  1361                                   public MVedVideoClipInfoObserver                                  
       
  1362     {
       
  1363 public:
       
  1364     /* 
       
  1365     * Static constructor.
       
  1366     */
       
  1367     static CVedMovieAddClipOperation* NewL(CVedMovie* aMovie);
       
  1368 
       
  1369     /*
       
  1370     * Notify that the video clip info is ready.
       
  1371     */
       
  1372     void NotifyVideoClipInfoReady(CVedVideoClipInfo& aInfo, 
       
  1373                                           TInt aError);    
       
  1374 
       
  1375 protected:
       
  1376     /*
       
  1377     * From CActive.
       
  1378     * Standard active object RunL function.
       
  1379     */
       
  1380     void RunL();
       
  1381  
       
  1382     /*
       
  1383     * From CActive.
       
  1384     * Standard active object DoCancel function.
       
  1385     */
       
  1386     void DoCancel();
       
  1387 
       
  1388 private:
       
  1389     /* Default constructor */
       
  1390     CVedMovieAddClipOperation(CVedMovie* aMovie);
       
  1391     
       
  1392     /* Standard Symbian OS two phased contructor */
       
  1393     void ConstructL();
       
  1394 
       
  1395     /* Destructor */
       
  1396     ~CVedMovieAddClipOperation();
       
  1397 
       
  1398     /* Called when video add operation has been completed */
       
  1399     void CompleteAddVideoClipOperation();
       
  1400 
       
  1401 
       
  1402 private:
       
  1403     // Pointer to movie class this operation is part of.
       
  1404     CVedMovieImp* iMovie;
       
  1405 
       
  1406     // Video clip to be added.
       
  1407     CVedVideoClip* iVideoClip;
       
  1408     // Does the video clip to be added own the generator?
       
  1409     TBool iIsVideoGeneratorOwnedByVideoClip;
       
  1410 
       
  1411     // Error code of add operation
       
  1412     TInt iError;
       
  1413 
       
  1414     friend class CVedMovieImp;
       
  1415     };
       
  1416 
       
  1417 
       
  1418 #endif // __VEDMOVIEIMP_H__
       
  1419