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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __VIDEORECORDER_H__
17 #define __VIDEORECORDER_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>
28 class CMMFVideoRecorderCallback;
34 An interface to a set of video recorder callback functions.
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
45 class MVideoRecorderUtilityObserver
50 Notification to the client that the opening of the video clip has completed,
51 successfully, or otherwise.
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.
58 virtual void MvruoOpenComplete(TInt aError) = 0;
61 Notification that video recorder is ready to begin recording. This callback
62 is generated in response to a call to Prepare.
65 This is either KErrNone if the video recorder has been prepared for
66 recording successfully, or one of the system wide error codes
68 virtual void MvruoPrepareComplete(TInt aError) = 0;
71 Notification that video recording has completed. This is not called if
72 recording is explicitly stopped by calling Stop.
75 This is either KErrNone if recording was completed successfully,
76 or one of the system wide error codes.
78 virtual void MvruoRecordComplete(TInt aError) = 0;
81 General event notification from controller. These events are specified by
82 the supplier of the controller.
85 The event sent by the controller.
87 virtual void MvruoEvent(const TMMFEvent& aEvent) = 0;
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.
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.
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.
109 class CVideoRecorderUtility : public CBase,
110 public MMMFClientUtility
112 friend class CTestStepUnitMMFVidClient;
119 ~CVideoRecorderUtility();
120 IMPORT_C static CVideoRecorderUtility* NewL(MVideoRecorderUtilityObserver& aObserver,
121 TInt aPriority=EMdaPriorityNormal,
122 TInt aPref=EMdaPriorityPreferenceTimeAndQuality);
123 IMPORT_C void OpenFileL(const TDesC& aFileName,
127 const TDesC8& aVideoType = KNullDesC8,
128 TFourCC aAudioType = KMMFFourCCCodeNULL);
129 IMPORT_C void OpenFileL(const RFile& aFile,
133 const TDesC8& aVideoType = KNullDesC8,
134 TFourCC aAudioType = KMMFFourCCCodeNULL);
135 IMPORT_C void OpenDesL(TDes8& aDescriptor,
139 const TDesC8& aVideoType = KNullDesC8,
140 TFourCC aAudioType = KMMFFourCCCodeNULL);
141 IMPORT_C void OpenUrlL(const TDesC& aUrl,
146 const TDesC8& aVideoType = KNullDesC8,
147 TFourCC aAudioType = KMMFFourCCCodeNULL);
148 IMPORT_C void Close();
149 IMPORT_C void Prepare();
150 IMPORT_C void Record();
151 IMPORT_C TInt Stop();
152 IMPORT_C void PauseL();
153 IMPORT_C void SetPriorityL(TInt aPriority, TInt aPref);
154 IMPORT_C void GetPriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const;
155 IMPORT_C void SetVideoFrameRateL(TReal32 aFrameRate);
156 IMPORT_C TReal32 VideoFrameRateL() const;
157 IMPORT_C void SetVideoFrameSizeL(const TSize& aSize);
158 IMPORT_C void GetVideoFrameSizeL(TSize& aSize) const;
159 IMPORT_C void SetVideoBitRateL(TInt aBitRate);
160 IMPORT_C TInt VideoBitRateL();
161 IMPORT_C void SetAudioBitRateL(TInt aBitRate);
162 IMPORT_C TInt AudioBitRateL() const;
163 IMPORT_C void SetAudioEnabledL(TBool aEnabled);
164 IMPORT_C TBool AudioEnabledL() const;
165 IMPORT_C TTimeIntervalMicroSeconds DurationL() const;
166 IMPORT_C void SetMaxClipSizeL(TInt aClipSizeInBytes);
167 IMPORT_C void SetGainL(TInt aGain);
168 IMPORT_C TInt GainL() const;
169 IMPORT_C TInt MaxGainL() const;
170 IMPORT_C TInt NumberOfMetaDataEntriesL() const;
171 IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const;
172 IMPORT_C void AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
173 IMPORT_C void RemoveMetaDataEntryL(TInt aIndex);
174 IMPORT_C void ReplaceMetaDataEntryL(TInt aIndex,const CMMFMetaDataEntry& aNewEntry);
175 IMPORT_C TFourCC AudioTypeL() const;
176 IMPORT_C void SetVideoTypeL(const TDesC8& aType);
177 IMPORT_C void SetAudioTypeL(TFourCC aType);
178 IMPORT_C void GetSupportedVideoTypesL(CDesC8Array& aVideoTypes) const;
179 IMPORT_C void GetSupportedAudioTypesL(RArray<TFourCC>& aAudioTypes) const;
180 IMPORT_C TTimeIntervalMicroSeconds RecordTimeAvailable() const;
181 IMPORT_C const TDesC8& VideoFormatMimeType() const;
182 IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
183 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
184 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
185 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
186 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
187 IMPORT_C void SetPixelAspectRatioL(const TVideoAspectRatio& aAspectRatio);
188 IMPORT_C void GetPixelAspectRatioL(TVideoAspectRatio& aAspectRatio) const;
189 IMPORT_C void GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const;
190 IMPORT_C void SetAudioChannelsL(const TUint aNumChannels);
191 IMPORT_C TUint AudioChannelsL() const;
192 IMPORT_C void GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const;
193 IMPORT_C void SetAudioSampleRateL(const TUint aSampleRate);
194 IMPORT_C TUint AudioSampleRateL() const;
195 IMPORT_C void GetSupportedAudioSampleRatesL(RArray<TUint> &aSampleRates) const;
196 IMPORT_C void SetVideoEnabledL(TBool aEnabled);
197 IMPORT_C TBool VideoEnabledL() const;
198 IMPORT_C void SetVideoQualityL(TInt aQuality);
199 IMPORT_C TInt VideoQualityL() const;
200 IMPORT_C void SetVideoFrameRateFixedL(TBool aFixedFrameRate);
201 IMPORT_C TBool VideoFrameRateFixedL() const;
204 enum TMMFVideoRecorderState