epoc32/include/videorecorder.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 videorecorder.h
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __VIDEORECORDER_H__
       
    17 #define __VIDEORECORDER_H__
       
    18 
       
    19 #include <f32file.h>
       
    20 #include <mmf/common/mmfbase.h>
       
    21 #include <mmf/common/mmfutilities.h>
       
    22 #include <mmf/common/mmfcontroller.h>
       
    23 #include <mmf/common/mmfstandardcustomcommands.h>
       
    24 #include <mmf/common/mmfcontrollerframeworkbase.h>
       
    25 #include <mda/common/base.h>
       
    26 #include <mmfclntutility.h>      
       
    27 
       
    28 class CMMFVideoRecorderCallback;
       
    29 
       
    30 /**
       
    31 @publishedAll
       
    32 @released
       
    33 
       
    34 An interface to a set of video recorder callback functions.
       
    35 
       
    36 The class is a mixin and is intended to be inherited by the client
       
    37 class which is observing the video recording operation. The functions
       
    38 encapsulated by this class are called when specific events occur in
       
    39 the process of initialising and recording a video clip. A reference to
       
    40 this object is passed as a parameter when constructing a video recorder
       
    41 utility object.
       
    42 
       
    43 @since 7.0s
       
    44 */
       
    45 class MVideoRecorderUtilityObserver
       
    46 	{
       
    47 public:
       
    48 
       
    49 	/**
       
    50 	Notification to the client that the opening of the video clip has completed,
       
    51 	successfully, or otherwise.
       
    52 	
       
    53 	@param  aError
       
    54 	        The status of the video recorder after initialisation.
       
    55 	        This is either KErrNone if the open has completed successfully,
       
    56 	        or one of the system wide error codes.
       
    57 	*/
       
    58 	virtual void MvruoOpenComplete(TInt aError) = 0;  
       
    59 
       
    60 	/**
       
    61 	Notification that video recorder is ready to begin recording. This callback
       
    62 	is generated in response to a call to Prepare.
       
    63 
       
    64 	@param  aError
       
    65 	        This is either KErrNone if the video recorder has been prepared for
       
    66 	        recording successfully, or one of the system wide error codes
       
    67 	*/
       
    68 	virtual void MvruoPrepareComplete(TInt aError) = 0;
       
    69 
       
    70 	/**
       
    71 	Notification that video recording has completed. This is not called if
       
    72 	recording is explicitly stopped by calling Stop.
       
    73 	
       
    74 	@param  aError
       
    75 	        This is either KErrNone if recording was completed successfully,
       
    76 	        or one of the system wide error codes.
       
    77 	*/
       
    78 	virtual void MvruoRecordComplete(TInt aError) = 0;
       
    79 
       
    80 	/**
       
    81 	General event notification from controller. These events are specified by
       
    82 	the supplier of the controller.
       
    83 
       
    84 	@param  aEvent
       
    85 	        The event sent by the controller.
       
    86 	*/
       
    87 	virtual void MvruoEvent(const TMMFEvent& aEvent) = 0;
       
    88 	};
       
    89 
       
    90 /**
       
    91 @publishedAll
       
    92 @released
       
    93 
       
    94 Records video data.
       
    95 
       
    96 The class offers a simple interface to record and set meta data and control information for a video
       
    97 clip and save the result to a file, descriptor or URL.
       
    98 
       
    99 Note:
       
   100 Some video formats also allow the storing of audio data. To accommodate this, this class contains
       
   101 audio functions that can manipulate such data.
       
   102 
       
   103 While this class is abstract, NewL() constructs, initialises and returns pointers to instances of
       
   104 concrete classes derived from this abstract class. This concrete class is part of the MMF
       
   105 implementation and is private.
       
   106 
       
   107 @since 7.0s
       
   108 */
       
   109 class CVideoRecorderUtility : public CBase,
       
   110 							  public MMMFClientUtility
       
   111 	{
       
   112 friend class CTestStepUnitMMFVidClient;
       
   113 
       
   114 	class CBody;
       
   115 
       
   116 public:
       
   117 
       
   118 
       
   119 	~CVideoRecorderUtility();
       
   120 	IMPORT_C static CVideoRecorderUtility* NewL(MVideoRecorderUtilityObserver& aObserver,TInt aPriority=EMdaPriorityNormal,TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);
       
   121 	IMPORT_C void OpenFileL(const TDesC& aFileName,
       
   122 							TInt aCameraHandle,
       
   123 							TUid aControllerUid,
       
   124 							TUid aVideoFormat,
       
   125 							const TDesC8& aVideoType = KNullDesC8,
       
   126 							TFourCC aAudioType = KMMFFourCCCodeNULL);
       
   127 	IMPORT_C void OpenFileL(const RFile& aFile,
       
   128 							TInt aCameraHandle,
       
   129 							TUid aControllerUid,
       
   130 							TUid aVideoFormat,
       
   131 							const TDesC8& aVideoType = KNullDesC8,
       
   132 							TFourCC aAudioType = KMMFFourCCCodeNULL);
       
   133     IMPORT_C void OpenDesL(TDes8& aDescriptor,
       
   134 							TInt aCameraHandle,
       
   135 							TUid aControllerUid,
       
   136 							TUid aVideoFormat,
       
   137 							const TDesC8& aVideoType = KNullDesC8,
       
   138 							TFourCC aAudioType = KMMFFourCCCodeNULL);
       
   139     IMPORT_C void OpenUrlL(const TDesC& aUrl,
       
   140 							TInt aIapId,
       
   141 							TInt aCameraHandle,
       
   142 							TUid aControllerUid,
       
   143 							TUid aVideoFormat,
       
   144 							const TDesC8& aVideoType = KNullDesC8,
       
   145 							TFourCC aAudioType = KMMFFourCCCodeNULL);
       
   146     IMPORT_C void Close();
       
   147     IMPORT_C void Prepare();
       
   148     IMPORT_C void Record();
       
   149     IMPORT_C TInt Stop();
       
   150     IMPORT_C void PauseL();
       
   151     IMPORT_C void SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref);
       
   152     IMPORT_C void GetPriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const;
       
   153     IMPORT_C void SetVideoFrameRateL(TReal32 aFrameRate);
       
   154     IMPORT_C TReal32 VideoFrameRateL() const;
       
   155     IMPORT_C void SetVideoFrameSizeL(const TSize& aSize);
       
   156     IMPORT_C void GetVideoFrameSizeL(TSize& aSize) const;
       
   157     IMPORT_C void SetVideoBitRateL(TInt aBitRate);
       
   158     IMPORT_C TInt VideoBitRateL();
       
   159     IMPORT_C void SetAudioBitRateL(TInt aBitRate);
       
   160     IMPORT_C TInt AudioBitRateL() const;
       
   161     IMPORT_C void SetAudioEnabledL(TBool aEnabled);
       
   162     IMPORT_C TBool AudioEnabledL() const;
       
   163     IMPORT_C TTimeIntervalMicroSeconds DurationL() const;
       
   164     IMPORT_C void SetMaxClipSizeL(TInt aClipSizeInBytes);
       
   165     IMPORT_C void SetGainL(TInt aGain);
       
   166     IMPORT_C TInt GainL() const;
       
   167     IMPORT_C TInt MaxGainL() const;
       
   168     IMPORT_C TInt NumberOfMetaDataEntriesL() const;
       
   169     IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const;
       
   170     IMPORT_C void AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
       
   171     IMPORT_C void RemoveMetaDataEntryL(TInt aIndex);
       
   172     IMPORT_C void ReplaceMetaDataEntryL(TInt aIndex,const CMMFMetaDataEntry& aNewEntry);
       
   173     IMPORT_C TFourCC AudioTypeL() const;
       
   174     IMPORT_C void SetVideoTypeL(const TDesC8& aType);
       
   175     IMPORT_C void SetAudioTypeL(TFourCC aType);
       
   176     IMPORT_C void GetSupportedVideoTypesL(CDesC8Array& aVideoTypes) const;
       
   177     IMPORT_C void GetSupportedAudioTypesL(RArray<TFourCC>& aAudioTypes) const;
       
   178     IMPORT_C TTimeIntervalMicroSeconds RecordTimeAvailable() const;
       
   179     IMPORT_C const TDesC8& VideoFormatMimeType() const;
       
   180     IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
       
   181     IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
       
   182     IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
       
   183     IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
       
   184     IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
       
   185     IMPORT_C void SetPixelAspectRatioL(const TVideoAspectRatio& aAspectRatio);
       
   186     IMPORT_C void GetPixelAspectRatioL(TVideoAspectRatio& aAspectRatio) const;
       
   187     IMPORT_C void GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const;
       
   188     IMPORT_C void SetAudioChannelsL(const TUint aNumChannels);
       
   189     IMPORT_C TUint AudioChannelsL() const;
       
   190     IMPORT_C void GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const;
       
   191     IMPORT_C void SetAudioSampleRateL(const TUint aSampleRate);    
       
   192     IMPORT_C TUint AudioSampleRateL() const;
       
   193     IMPORT_C void GetSupportedAudioSampleRatesL(RArray<TUint> &aSampleRates) const;
       
   194 
       
   195     // SetVideoEnabledL() is publishedPartner and prototype as it is not yet used by licensees,
       
   196     // and there is a possibility that it may change on licensee request for a short period.
       
   197     // It will eventually be moved to publishedAll and released.
       
   198     IMPORT_C void SetVideoEnabledL(TBool aEnabled);
       
   199 
       
   200     // VideoEnabledL() is publishedPartner and prototype as it is not yet used by licensees,
       
   201     // and there is a possibility that it may change on licensee request for a short period.
       
   202     // It will eventually be moved to publishedAll and released.
       
   203     IMPORT_C TBool VideoEnabledL() const;
       
   204 
       
   205     // SetVideoQualityL() is publishedPartner and prototype as it is not yet used by licensees,
       
   206     // and there is a possibility that it may change on licensee request for a short period.
       
   207     // It will eventually be moved to publishedAll and released.
       
   208     IMPORT_C void SetVideoQualityL(TInt aQuality);
       
   209 
       
   210     // VideoQualityL() is publishedPartner and prototype as it is not yet used by licensees,
       
   211     // and there is a possibility that it may change on licensee request for a short period.
       
   212     // It will eventually be moved to publishedAll and released.
       
   213     IMPORT_C TInt VideoQualityL() const;
       
   214 
       
   215     // SetVideoFrameRateFixedL() is publishedPartner and prototype as it is not yet used by licensees,
       
   216     // and there is a possibility that it may change on licensee request for a short period.
       
   217     // It will eventually be moved to publishedAll and released.
       
   218     IMPORT_C void SetVideoFrameRateFixedL(TBool aFixedFrameRate);
       
   219 
       
   220     // VideoFrameRateFixedL() is publishedPartner and prototype as it is not yet used by licensees,
       
   221     // and there is a possibility that it may change on licensee request for a short period.
       
   222     // It will eventually be moved to publishedAll and released.
       
   223     IMPORT_C TBool VideoFrameRateFixedL() const;
       
   224 private:
       
   225 	enum TMMFVideoRecorderState
       
   226 		{
       
   227 		EStopped,
       
   228 		EOpening,
       
   229 		EPaused,
       
   230 		ERecording
       
   231 		};
       
   232 
       
   233 private:
       
   234 	CBody* iBody;
       
   235 	friend class CBody;
       
   236 	};
       
   237 
       
   238 #endif