mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/inc/mcefilesource.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2006 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 MCEFILESOURCE_H
       
    20 #define MCEFILESOURCE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "mcemediasource.h"
       
    24 #include "mcemediastream.h"
       
    25 
       
    26 // CONSTANTS
       
    27 const TMceSourceType KMceFileSource = 4;
       
    28 
       
    29 //FORWARD DECLARATIONS
       
    30 class CMceManager;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Class representing file source in MCE.
       
    36 *
       
    37 * CMceFileSource can be used for streaming file contents. The file may contain
       
    38 * both audio and video data. If the user wants to stream both media types,
       
    39 * the same file source should be attached to audio stream and video stream. 
       
    40 *
       
    41 * The file may contain also several elements of the same media type (e.g. 
       
    42 * 3 audio channels) and the user might want to use only some of those. 
       
    43 * This can be handled by defining index of the file's current media element:
       
    44 *
       
    45 * - Get number of audio media elements within the file (e.g. returns 3)
       
    46 * - Set current audio element index to be 0
       
    47 * - Attach the file source to the audioStreamOne (audio element 0 is attached)
       
    48 * - Set current audio element index to be 2
       
    49 * - Attach the file source to the audioStreamTwo (audio element 2 is attached)
       
    50 * - Consequently, file's audio channel 0 would be streamed over the audioStreamOne
       
    51 *   and channel 2 over the audioStreamTwo. Channel 1 would be ignored.
       
    52 *
       
    53 * Enable (continue) and Disable (pause) operations to it are considered
       
    54 * to be local, so they are not signalled to remote terminal.
       
    55 * 
       
    56 * @lib mceclient.lib
       
    57 */
       
    58 class CMceFileSource : public CMceMediaSource
       
    59 	{
       
    60 
       
    61 	public: // Constructors and destructor
       
    62 
       
    63 	    /**
       
    64 	    * Two-phased constructor.
       
    65 	    * @param aManager associated MCE manager
       
    66 	    * @param aFileName name of the file including full path info
       
    67 	    */
       
    68 		IMPORT_C static CMceFileSource* NewL( CMceManager& aManager,
       
    69 		                                      const TFileName& aFileName );
       
    70 
       
    71 	    /**
       
    72 	    * Two-phased constructor.
       
    73 	    * @param aManager associated MCE manager
       
    74 	    * @param aFileName name of the file including full path info
       
    75 	    */
       
    76 		IMPORT_C static CMceFileSource* NewLC( CMceManager& aManager,
       
    77 		                                       const TFileName& aFileName );
       
    78 		
       
    79 	    /**
       
    80 	    * Destructor.
       
    81 	    */
       
    82 		IMPORT_C ~CMceFileSource();
       
    83 
       
    84 
       
    85 	public: // From CMceMediaSource
       
    86 
       
    87 	    /**
       
    88 	    * Enables the source explicitly.
       
    89 	    */
       
    90 		IMPORT_C void EnableL(); 
       
    91 
       
    92 	    /**
       
    93 	    * Disables the source explicitly.
       
    94 	    */
       
    95 		IMPORT_C void DisableL(); 
       
    96 
       
    97 
       
    98 	public: // Functions
       
    99 
       
   100         /**
       
   101         * Updates file for the source.
       
   102         * @param aFileName name of the file including full path info
       
   103         */
       
   104         IMPORT_C void UpdateL ( const TFileName& aFileName );
       
   105 
       
   106         /**
       
   107         * Determines how many media elements of the spesified type the file
       
   108         * source contains. E.g. audio file may contain N number of audio
       
   109         * channels which has to be streamed over N number of audio streams.
       
   110         * @param aType the type of media
       
   111         * @return the number of media elements (of spesified type)
       
   112         *         the file contains
       
   113         */
       
   114         IMPORT_C TInt MediaElementCountL( TMceMediaType aType ) const;
       
   115         
       
   116         /**
       
   117         * Sets currently managed media element of the spesified media type. 
       
   118         * The setting is effective when the file source is attached to
       
   119         * media stream of the spesified type. Current media element can be
       
   120         * defined for each media type the file contains. By default, media
       
   121         * element 0 of each media type is used.
       
   122         * @param aType the type of media
       
   123         * @param aIndex new index of the current media element
       
   124         * @leave KErrArgument if media element spesified by input parameters
       
   125         *        does not exist
       
   126         */
       
   127         IMPORT_C void SetCurrentMediaElementL( TMceMediaType aType, TInt aIndex );
       
   128 
       
   129         /**
       
   130         * Gets currently managed media element of the spesified media type. 
       
   131         * @param aType the type of media
       
   132         * @return index of the current media element or KErrNotFound if no media
       
   133         *         elements of the spesified type exists
       
   134         */
       
   135         IMPORT_C TInt CurrentMediaElement( TMceMediaType aType );
       
   136         
       
   137         /**
       
   138         * Sets the position within the file from where to start playback.
       
   139         * @pre IsEnabled() == EFalse and contains audio/video
       
   140         * @param aPosition from start of the file in microseconds
       
   141         */
       
   142         IMPORT_C void SetPositionL( const TTimeIntervalMicroSeconds& aPosition );
       
   143         
       
   144         /**
       
   145         * Gets the current playback position in microseconds from the start of the file.
       
   146         * @pre contains audio/video
       
   147         * @return current position from start of the file in microseconds
       
   148         */
       
   149         IMPORT_C TTimeIntervalMicroSeconds PositionL() const;
       
   150         
       
   151         /**
       
   152         * Returns the duration of the file in microseconds.
       
   153         * @pre contains audio/video
       
   154         * @return duration of the file in microseconds.
       
   155         */
       
   156         IMPORT_C TTimeIntervalMicroSeconds DurationL() const;
       
   157 
       
   158         /**
       
   159         * Sets fast forward on/off.
       
   160         * @pre contains video
       
   161         * @param aUseFFWD ETrue if fast forward is enabled; otherwise EFalse
       
   162         */
       
   163         IMPORT_C void SetFastForwardL( TBool aUseFFWD );
       
   164         
       
   165         /**
       
   166         * Sets fast rewind on/off.
       
   167         * @pre contains video
       
   168         * @param aUseFRWD ETrue if fast rewind is enabled; otherwise EFalse
       
   169         */
       
   170         IMPORT_C void SetFastRewindL( TBool aUseFRWD );
       
   171 
       
   172         /**
       
   173         * Starts transcoding of file. After the transcoding is complete,
       
   174         * file of this source is changed into the transcoded file.
       
   175         * @pre CMceMediaStream::State() == ETranscodingRequired
       
   176         * @post CMceMediaStream::State() == ETranscoding
       
   177         * @param aFileName Name of the transcoding output file.
       
   178         */
       
   179         IMPORT_C void TranscodeL( const TFileName& aFileName );
       
   180 
       
   181         /**
       
   182         * Cancels transcoding of file. 
       
   183         * @pre CMceMediaStream::State() == ETranscoding
       
   184         * @post CMceMediaStream::State() == ETranscodingRequired
       
   185         */
       
   186         IMPORT_C void CancelTranscodeL();
       
   187 
       
   188         /**
       
   189         * Gets the current transcoding progress in percentage.
       
   190         * Value is updated with MMceStreamObserver::StreamStateChanged() event.
       
   191         * @pre CMceMediaStream::State() == ETranscoding
       
   192         * @return Transcoding progress in persentage (0-100).
       
   193         */
       
   194         IMPORT_C TInt TranscodingProgressL() const;
       
   195         
       
   196 
       
   197 	public: // internal
       
   198 	
       
   199 	    /**
       
   200 	    * Initializes 
       
   201 	    * @param aManager the manager. Ownership is NOT transferred
       
   202 	    */
       
   203 	    void InitializeL( CMceManager* aManager );
       
   204 	    
       
   205 	public: 
       
   206 
       
   207 	    /**
       
   208 	    * Two-phased constructor.
       
   209 	    */
       
   210 	    static CMceFileSource* NewL();
       
   211 
       
   212 	    /**
       
   213 	    * Two-phased constructor.
       
   214 	    */
       
   215 		static CMceFileSource* NewLC();
       
   216 
       
   217 	private:
       
   218 
       
   219 	    /**
       
   220 	    * C++ default constructor.
       
   221 	    */
       
   222 		CMceFileSource();
       
   223 
       
   224 	    /**
       
   225 	    * Second-phase constructor.
       
   226 	    */
       
   227 		void ConstructL( CMceManager* aManager,
       
   228 		                 const TFileName& aFileName );	  
       
   229 
       
   230 
       
   231     public: // Stub data
       
   232 
       
   233         TBool iFastForward;
       
   234         TBool iFastRewind;
       
   235         TTimeIntervalMicroSeconds iPosition;
       
   236 
       
   237         //TMceFileInfo iFileInfo;
       
   238         //TBuf8<256> iFileName;
       
   239         
       
   240         TBool iInitialInfoRetrieved;    
       
   241 
       
   242         TInt iCurrentAudioElement;
       
   243         TInt iCurrentVideoElement;  
       
   244         
       
   245         
       
   246         TFileName iFileName;
       
   247         TTimeIntervalMicroSeconds iDuration;
       
   248         TInt iAudioElementCount;
       
   249         TInt iVideoElementCount;
       
   250         
       
   251         TInt iTranscodingPercentage;
       
   252         
       
   253         // If this code is != KErrNone, next operation that can fail will fail
       
   254 	    // (leave or return a value) with this code. Variable is reseted before 
       
   255 	    // failing. 
       
   256 	    // Obs! Check that wanted failing is really implemented in this stub
       
   257 	    mutable TInt iFailWithCode;
       
   258 	    
       
   259 	};
       
   260 
       
   261 
       
   262 #endif