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