mmshplugins/mmcctranscoder/tsrc/stubs/inc/vedmovie.h
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __VEDMOVIE_H__
       
    20 #define __VEDMOVIE_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 #include "VedVideoClipInfo.h"
       
    25 #include "VedAudioClipInfo.h"
       
    26 
       
    27 /*
       
    28  *  Constant definitions.
       
    29  */
       
    30 
       
    31 const TInt KVedClipIndexAll(-1);
       
    32 
       
    33 
       
    34 
       
    35 
       
    36 class CVedMovie;
       
    37 class TVedDynamicLevelMark;
       
    38 
       
    39 /**
       
    40  * Observer for movie events. 
       
    41  * <p>
       
    42  * Note that every change operation that is made to a movie or the clips it consists of 
       
    43  * results in a maximum of one notification method called (that is, more than one 
       
    44  * notification method is never called as a result of a single change). For example,
       
    45  * changing the index of a clip results in the <code>NotifyVideoClipIndicesChanged()</code>
       
    46  * method being called once. The <code>NotifyVideoClipTimingsChanged()</code> method is not 
       
    47  * called even if the timings of several clips may have changed as a result. See the
       
    48  * descriptions of the notification methods for more detailed information.
       
    49  *
       
    50  * @see  CVedMovie
       
    51  */
       
    52 class MVedMovieObserver 
       
    53     {
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Called to notify that a new video clip has been successfully
       
    58      * added to the movie. Note that the indices and the start and end times
       
    59      * of the video clips after the new clip have also changed as a result.
       
    60      * Note that the transitions may also have changed. 
       
    61      *
       
    62      * @param aMovie  movie
       
    63      * @param aIndex  index of video clip in movie
       
    64      */
       
    65     virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex) = 0;
       
    66 
       
    67     /**
       
    68      * Called to notify that adding a new video clip to the movie has failed.
       
    69      *
       
    70      * Possible error codes:
       
    71      *  - <code>KErrNotFound</code> if there is no file with the specified name
       
    72      *    in the specified directory (but the directory exists)
       
    73      *  - <code>KErrPathNotFound</code> if the specified directory
       
    74      *    does not exist
       
    75      *  - <code>KErrUnknown</code> if the specified file is of unknown format
       
    76      *  - <code>KErrNotSupported</code> if the format of the file is recognized but
       
    77      *    adding it to the movie is not supported (e.g., it is of different resolution
       
    78      *    or format than the other clips)
       
    79      *
       
    80      * @param aMovie  movie
       
    81      * @param aError  one of the system wide error codes
       
    82      */
       
    83     virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError) = 0;
       
    84 
       
    85     /**
       
    86      * Called to notify that a video clip has been removed from the movie.
       
    87      * Note that the indices and the start and end times of the video clips after 
       
    88      * the removed clip have also changed as a result. Note that the 
       
    89      * transitions may also have changed.
       
    90      *
       
    91      * @param aMovie  movie
       
    92      * @param aIndex  index of the removed video clip
       
    93      */
       
    94     virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex) = 0;
       
    95     
       
    96     /**
       
    97      * Called to notify that a video clip has moved (that is, its index and 
       
    98      * start and end times have changed). Note that the indices and the start and
       
    99      * end times of the clips between the old and new indices have also changed 
       
   100      * as a result. Note that the transitions may also have changed.
       
   101      *
       
   102      * @param aMovie     movie
       
   103      * @param aOldIndex  old index of the moved clip
       
   104      * @param aNewIndex  new index of the moved clip
       
   105      */
       
   106     virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
       
   107                                                TInt aNewIndex) = 0;
       
   108 
       
   109     /**
       
   110      * Called to notify that the timings (that is, the cut in or cut out time or
       
   111      * the speed and consequently the end time, edited duration, and possibly audio
       
   112      * settings) of a video clip have changed (but the index of the clip has 
       
   113      * <em>not</em> changed). Note that the start and end times of the video clips 
       
   114      * after the changed clip have also changed.
       
   115      *
       
   116      * @param aMovie  movie
       
   117      * @param aClip   changed video clip
       
   118      */
       
   119     virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
       
   120                                                TInt aIndex) = 0;
       
   121 
       
   122     /**
       
   123      * Called to notify that the color effect or a color tone of the existing effect
       
   124      * of a video clip has changed.
       
   125      *
       
   126      * @param aMovie  movie
       
   127      * @param aClip   changed video clip
       
   128      */
       
   129     virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
       
   130                                                    TInt aIndex) = 0;
       
   131     
       
   132     /**
       
   133      * Called to notify that the audio settings of a video clip have changed. 
       
   134      *
       
   135      * @param aMovie  movie
       
   136      * @param aClip   changed video clip
       
   137      */
       
   138     virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
       
   139                                                      TInt aIndex) = 0;
       
   140 
       
   141     /**
       
   142      * Called to notify that some generator-specific settings of 
       
   143      * a generated video clip have changed.
       
   144      *
       
   145      * @param aMovie  movie
       
   146      * @param aClip   changed video clip
       
   147      */
       
   148     virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
       
   149                                                          TInt aIndex) = 0;
       
   150 
       
   151     /**
       
   152      * Called to notify that the descriptive name of a clip has changed. 
       
   153      *
       
   154      * @param aMovie  movie
       
   155      * @param aIndex  changed video clip index
       
   156      */
       
   157     virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
       
   158                                                                 TInt aIndex) = 0;
       
   159 
       
   160     /**
       
   161      * Called to notify that the start transition effect of the movie
       
   162      * has changed (but no other changes have occurred).
       
   163      *
       
   164      * @param aMovie  movie
       
   165      */
       
   166     virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie) = 0;
       
   167 
       
   168     /**
       
   169      * Called to notify that a middle transition effect has changed 
       
   170      * (but no other changes have occurred).
       
   171      *
       
   172      * @param aMovie  movie
       
   173      * @param aIndex  index of the changed middle transition effect
       
   174      */
       
   175     virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
       
   176                                                      TInt aIndex) = 0;
       
   177 
       
   178     /**
       
   179      * Called to notify that the end transition effect of the movie
       
   180      * has changed (but no other changes have occurred).
       
   181      *
       
   182      * @param aMovie  movie
       
   183      */
       
   184     virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie) = 0;
       
   185 
       
   186     /**
       
   187      * Called to notify that a new audio clip has been successfully
       
   188      * added to the movie. Note that the indices of the audio clips
       
   189      * starting after the new clip have also changed as a result.
       
   190      *
       
   191      * @param aMovie  movie
       
   192      * @param aClip   new audio clip
       
   193      */
       
   194     virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex) = 0;
       
   195 
       
   196     /**
       
   197      * Called to notify that adding a new audio clip to the movie has failed.
       
   198      *
       
   199      * Possible error codes:
       
   200      *  - <code>KErrNotFound</code> if there is no file with the specified name
       
   201      *    in the specified directory (but the directory exists)
       
   202      *  - <code>KErrPathNotFound</code> if the specified directory
       
   203      *    does not exist
       
   204      *  - <code>KErrUnknown</code> if the specified file is of unknown format
       
   205      *
       
   206      * @param aMovie  movie
       
   207      * @param aError  one of the system wide error codes
       
   208      */
       
   209     virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError) = 0;
       
   210 
       
   211     /**
       
   212      * Called to notify that an audio clip has been removed from the movie.
       
   213      * Note that the indices of the audio clips starting after the removed
       
   214      * clip have also changed as a result.
       
   215      *
       
   216      * @param aMovie  movie
       
   217      * @param aIndex  index of the removed audio clip
       
   218      */
       
   219     virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex) = 0;
       
   220 
       
   221     /**
       
   222      * Called to notify that an audio clip has moved (that is, its
       
   223      * index has changed). This may happen when the start time of the audio 
       
   224      * clip is changed. Note that the indices of the clips between the old and 
       
   225      * new indices have also changed as a result.
       
   226      *
       
   227      * @param aMovie     movie
       
   228      * @param aOldIndex  old index of the moved clip
       
   229      * @param aNewIndex  new index of the moved clip
       
   230      */
       
   231     virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
       
   232                                                TInt aNewIndex) = 0;
       
   233 
       
   234     /**
       
   235      * Called to notify that the timings (for example, the start time or
       
   236      * the duration) of an audio clip have changed (but the index of the
       
   237      * clip has <em>not</em> changed as a result).
       
   238      *
       
   239      * @param aMovie  movie
       
   240      * @param aClip   changed audio clip
       
   241      */
       
   242     virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
       
   243                                                TInt aIndex) = 0;
       
   244 
       
   245     /**
       
   246      * Called to notify that the quality setting of the movie has been
       
   247      * changed.
       
   248      *
       
   249      * @param aMovie  movie
       
   250      */
       
   251     virtual void NotifyMovieQualityChanged(CVedMovie& aMovie) = 0;
       
   252 
       
   253     /**
       
   254      * Called to notify that the movie has been reseted.
       
   255      *
       
   256      * @param aMovie  movie
       
   257      */
       
   258     virtual void NotifyMovieReseted(CVedMovie& aMovie) = 0;
       
   259     
       
   260     /**
       
   261      * Called to notify that the output parameters have been changed
       
   262      *
       
   263      * @param aMovie  movie
       
   264      */
       
   265     virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie) = 0;
       
   266     
       
   267     /**
       
   268      * Called to notify that a dynamic level mark has been inserted 
       
   269      * to an audio clip.
       
   270      *
       
   271      * @param aMovie       movie
       
   272      * @param aClipIndex   audio clip index
       
   273      * @param aMarkIndex   index of the inserted level mark
       
   274      */
       
   275     virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
       
   276                                                          TInt aClipIndex, 
       
   277                                                          TInt aMarkIndex) = 0;
       
   278 
       
   279     /**
       
   280      * Called to notify that a dynamic level mark has been inserted 
       
   281      * to an audio clip.
       
   282      *
       
   283      * @param aMovie       movie
       
   284      * @param aClipIndex   audio clip index
       
   285      * @param aMarkIndex   index of the inserted level mark
       
   286      */
       
   287     virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
       
   288                                                         TInt aClipIndex, 
       
   289                                                         TInt aMarkIndex) = 0;
       
   290 
       
   291     /**
       
   292      * Called to notify that a dynamic level mark has been inserted 
       
   293      * to an audio clip.
       
   294      *
       
   295      * @param aMovie       movie
       
   296      * @param aClipIndex   audio clip index
       
   297      * @param aMarkIndex   index of the inserted level mark
       
   298      */
       
   299     virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
       
   300                                                          TInt aClipIndex, 
       
   301                                                          TInt aMarkIndex) = 0;
       
   302 
       
   303     /**
       
   304      * Called to notify that a dynamic level mark has been inserted 
       
   305      * to an audio clip.
       
   306      *
       
   307      * @param aMovie       movie
       
   308      * @param aClipIndex   audio clip index
       
   309      * @param aMarkIndex   index of the inserted level mark
       
   310      */
       
   311     virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
       
   312                                                         TInt aClipIndex, 
       
   313                                                         TInt aMarkIndex) = 0;    
       
   314     };
       
   315 
       
   316 
       
   317 /**
       
   318  * Observer for movie processing operations. 
       
   319  *
       
   320  * 
       
   321  * @see  CVedMovie
       
   322  */
       
   323 class MVedMovieProcessingObserver
       
   324     {
       
   325 public:
       
   326     /**
       
   327      * Called to notify that a new movie processing operation has been started. 
       
   328      *
       
   329      * @param aMovie  movie
       
   330      */
       
   331     virtual void NotifyMovieProcessingStartedL(CVedMovie& aMovie) = 0;
       
   332 
       
   333     /**
       
   334      * Called to inform about the current progress of the movie processing operation.
       
   335      *
       
   336      * @param aMovie       movie
       
   337      * @param aPercentage  percentage of the operation completed, must be 
       
   338      *                     in range 0..100
       
   339      */
       
   340     virtual void NotifyMovieProcessingProgressed(CVedMovie& aMovie, TInt aPercentage) = 0;
       
   341 
       
   342     /**
       
   343      * Called to notify that the movie processing operation has been completed. 
       
   344      * 
       
   345      * @param aMovie  movie
       
   346      * @param aError  error code why the operation was completed. 
       
   347      *                <code>KErrNone</code> if the operation was completed 
       
   348      *                successfully.
       
   349      */
       
   350     virtual void NotifyMovieProcessingCompleted(CVedMovie& aMovie, TInt aError) = 0;
       
   351     };
       
   352 
       
   353 
       
   354 /**
       
   355  * Video movie, which consists of zero or more video clips and zero or more audio clips.
       
   356  * 
       
   357  * @see  CVedVideoClip
       
   358  * @see  CVedAudioClip
       
   359  */
       
   360 class CVedMovie : public CBase
       
   361     {
       
   362 public:
       
   363 
       
   364     /**
       
   365      * Enumeration for movie quality settings.
       
   366      */
       
   367     enum TVedMovieQuality
       
   368         {
       
   369         EQualityAutomatic = 0,
       
   370         EQualityMMSInteroperability,
       
   371         EQualityResolutionCIF,      // Obsolete, please use Medium/High instead
       
   372         EQualityResolutionQCIF,     // Obsolete, please use Medium/High instead
       
   373         EQualityResolutionMedium,
       
   374         EQualityResolutionHigh,        
       
   375         EQualityLast  // this should always be the last
       
   376         };
       
   377 
       
   378 
       
   379 public:
       
   380 
       
   381     /* Constructors & destructor. */
       
   382 
       
   383     /**
       
   384      * Constructs a new empty CVedMovie object. May leave if no resources are available.
       
   385      * 
       
   386      * Possible leave codes:
       
   387      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   388      *
       
   389      * @param aFs  file server session to use to lock the video and audio
       
   390      *             clip files of the new movie; or NULL to not to lock the files
       
   391      *
       
   392      * @return  pointer to a new CVedMovie instance
       
   393      */
       
   394     static CVedMovie* NewL(RFs* aFs);
       
   395 
       
   396     /**
       
   397      * Constructs a new empty CVedMovie object and leaves the object in the cleanup stack.
       
   398      * 
       
   399      * Possible leave codes:
       
   400      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   401      * 
       
   402      * @param aFs  file server session to use to lock the video and audio
       
   403      *             clip files of the new movie; or NULL to not to lock the files
       
   404      *
       
   405      * @return  pointer to a new CVedMovie instance
       
   406      */
       
   407     static CVedMovie* NewLC(RFs* aFs);
       
   408     
       
   409     
       
   410     ~CVedMovie();
       
   411 
       
   412 
       
   413     /**
       
   414      * Sets the quality setting of this movie.
       
   415      *
       
   416      * @param aQuality  quality setting
       
   417      */
       
   418     virtual void SetQuality(TVedMovieQuality aQuality);
       
   419 
       
   420 
       
   421     /**
       
   422      * Returns the video type of this movie. 
       
   423      * 
       
   424      * @return  video type of this movie
       
   425      */
       
   426     virtual TVedVideoType VideoType() const;
       
   427 
       
   428     /**
       
   429      * Returns the resolution of this movie. Panics with 
       
   430      * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
       
   431      * in the movie.
       
   432      * 
       
   433      * @return  resolution of the movie
       
   434      */
       
   435     virtual TSize Resolution() const;
       
   436 
       
   437     /**
       
   438      * Returns the audio type of the movie audio track.
       
   439      * 
       
   440      * @return  audio type of the movie audio track
       
   441      */
       
   442     virtual TVedAudioType AudioType() const;
       
   443 
       
   444     /**
       
   445      * Returns the audio sampling rate of the movie audio track.
       
   446      *
       
   447      * @return  audio sampling rate of the movie audio track.
       
   448      */
       
   449     virtual TInt AudioSamplingRate() const;
       
   450 
       
   451     /**
       
   452      * Returns the audio channel mode of the movie audio track.
       
   453      * 
       
   454      * @return  audio channel mode of the movie audio track.
       
   455      */
       
   456     virtual TVedAudioChannelMode AudioChannelMode() const;
       
   457 
       
   458 
       
   459     /** 
       
   460      * Inserts a video clip from the specified file to the specified index 
       
   461      * in this movie. The observers are notified when the clip has been added 
       
   462      * or adding clip has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
       
   463      * if another add video or audio clip operation is already running.
       
   464      * Panics with code <code>USER-130</code> if the clip index is invalid.
       
   465      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   466      * and the same mode should be used by the client too if it need to open
       
   467      * the file at the same time.
       
   468      *  
       
   469      * Possible leave codes:
       
   470      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   471      *
       
   472      * @param aFileName  file name of the clip to add
       
   473      * @param aIndex     index the clip should be inserted at
       
   474      */
       
   475     virtual void InsertVideoClipL(const TDesC& aFileName, TInt aIndex);
       
   476 
       
   477 
       
   478 
       
   479     /* Processing methods. */
       
   480 
       
   481     /**
       
   482      * Starts a video processing operation. This method is asynchronous and 
       
   483      * returns immediately. The processing will happen in the background and
       
   484      * the observer will be notified about the progress of the operation.
       
   485      * Processed data is written into the specified file. Panics with 
       
   486      * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
       
   487      * in the movie. Note that calling <code>ProcessL</code> may cause
       
   488      * changes in the maximum frame rates of generated clips.
       
   489      * 
       
   490      * Possible leave codes:
       
   491      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   492      *  - <code>KErrAccessDenied</code> if the file access is denied
       
   493      *  - <code>KErrDiskFull</code> if the disk is full
       
   494      *  - <code>KErrWrite</code> if not all data could be written
       
   495      *  - <code>KErrBadName</code> if the filename is bad
       
   496      *  - <code>KErrDirFull</code> if the directory is full
       
   497      * 
       
   498      * @param aObserver  observer to be notified of the processing status
       
   499      * @param aFileName  name of the file to be written
       
   500      */
       
   501     virtual void ProcessL(const TDesC& aFileName,
       
   502                            MVedMovieProcessingObserver& aObserver);
       
   503 
       
   504     /**
       
   505      * Cancels the current video processing operation. If there is no 
       
   506      * operation in progress, the function does nothing.
       
   507      */
       
   508     virtual void CancelProcessing();
       
   509 
       
   510 
       
   511     /* Observer methods. */
       
   512 
       
   513     /**
       
   514      * Registers a movie observer. Panics with panic code 
       
   515      * <code>EMovieObserverAlreadyRegistered</code> if the movie observer is 
       
   516      * already registered.
       
   517      *
       
   518      * @param aObserver  observer that will receive the events
       
   519      */
       
   520     virtual void RegisterMovieObserverL(MVedMovieObserver* aObserver);
       
   521 
       
   522     /**
       
   523      * Unregisters a movie observer.
       
   524      *
       
   525      * @param aObserver  observer to be unregistered
       
   526      */
       
   527     virtual void UnregisterMovieObserver(MVedMovieObserver* aObserver);
       
   528 
       
   529 
       
   530     /**
       
   531      * Returns the target bitrate of the movie audio track.
       
   532      * 
       
   533      * @return  target bitrate of the movie audio track.
       
   534      */
       
   535     virtual TInt AudioBitrate() const;
       
   536 
       
   537     /**
       
   538      * Returns the target framerate of the movie video track.
       
   539      * 
       
   540      * @return  target framerate of the movie video track.
       
   541      */
       
   542     virtual TReal VideoFrameRate() const;
       
   543 
       
   544     /**
       
   545      * Sets the output parameters for the movie. Leaves
       
   546      * with KErrNotSupported if a parameter is illegal,
       
   547      * e.g., target bitrate is too high for the given 
       
   548      * codec. Setting a integer parameter to zero indicates
       
   549      * that a default value will be used for that parameter.
       
   550      *
       
   551      * This method overrides the SetQuality method
       
   552      *
       
   553      * Possible leave codes:
       
   554      *  - <code>KErrNotSupported</code> if setting is not valid
       
   555      *
       
   556      * @param Output parameters
       
   557      */
       
   558     
       
   559     virtual void SetOutputParametersL(TVedOutputParameters& aOutputParams);
       
   560 
       
   561 public: // Stub stuff
       
   562 
       
   563     void ConstructL();
       
   564     
       
   565     CVedMovie();
       
   566 
       
   567     enum TVedMovieCurrentCallbackType
       
   568         {
       
   569         ENotifyVideoClipAdded,
       
   570         ENotifyMovieQualityChanged,
       
   571         ENotifyMovieOutputParametersChanged,
       
   572         ENotifyMovieProcessingStartedL,
       
   573         ENotifyMovieProcessingProgressed,
       
   574         ENotifyMovieProcessingCompleted
       
   575         };
       
   576         
       
   577     void IssueCallback( TVedMovieCurrentCallbackType aCallback );
       
   578 		
       
   579 	static TInt AsyncTimerExpired(TAny* aPtr);
       
   580 	
       
   581 	void DoCurrentCallbackL();
       
   582 
       
   583     MVedMovieObserver* iObserver;
       
   584     MVedMovieProcessingObserver* iProcessObserver;
       
   585     
       
   586     CDeltaTimer* 				iDeltaTimer;
       
   587     TCallBack 					iDeltaTimerCallBack;
       
   588 	TDeltaTimerEntry 			iDeltaTimerEntry;
       
   589 	
       
   590 	TVedMovieCurrentCallbackType iCurrentCallback;
       
   591 	TInt iProgress;
       
   592 	
       
   593 	TVedMovieQuality iQuality;
       
   594 	TVedOutputParameters iOutputParams;
       
   595 	TVedAudioType iAudioType;
       
   596     
       
   597     };
       
   598 
       
   599 
       
   600 #endif // __VEDMOVIE_H__
       
   601