First public contribution.
1 // Copyright (c) 2005-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.
14 // Part of the MVS Application for TechView
22 #include <mda/common/controller.h>
24 #include <techview/eikdialg.h>
27 #include "MVSAppView.h"
28 #include "audioplayagent.h"
29 #include "audiorecordagent.h"
30 #include "videoplayagent.h"
31 #include "videorecordagent.h"
32 #include "SettingsManager.h"
34 const TInt KMaxExtensionSize = 16;
35 const TInt KMaxDisplayLabelSize = 32;
36 const TInt KMaxDollarPaddingBufferSize = 256;
37 const TInt KErrorTextLength = 80;
39 //forward declariotions.
40 //The volume dialog class, used to increase/decrease volume.
41 class CMVSVolumeDialog;
42 //The balance dialog class, used to set the balance to right/left/centre.
43 class CMVSBalanceDialog;
44 //The repeats dialog class, used to set the number of times a clip has to be played back, along with the delay between the playback.
45 class CMVSRepeatDialog;
46 //The Controller selction dialog class, used to select the format and the controller,before recording.
47 class CMVSSelectPluginsDialog;
48 //The SaveAs dialog class, used to input the file name in which the recorded data would be stored.
49 class CMVSSaveAsDialog;
50 //The MetaInfo Editing dialog class, used to edit the Metadata info for a clip.
51 class CMVSEditMetaInfoDialog;
52 //The audio controller settings dialog class, used to set controller specific features like bitrates,samplerates,channels etc.
53 class CMVSConfigAudioFormatDialog;
54 //The system info dialog class,used to display a list of all the supported controllers and codecs by the system.
55 class CMVSSystemInfoDialog;
56 //The video Setting dialog class, used to set the video playing/recording properties such as Rotation and Cropping.
57 class CMVSVideoSettingDialog;
58 //The audio Setting dialog class, used to set the audio playing properties such as priority preferences,repeats etc.
59 class CMVSAudioSettingDialog;
60 //The Play Window dialog class, used to set the play window for a audio clip, specifying the start and end position.
61 class CMVSSetPlayWindowDialog;
62 //The crop window setting class, used to set the cropping position for a recorded clip.
64 //The video controller settings dialog class, used to set controller specific features like framerates,framsize,codecs etc.
65 class CMVSConfigVideoFormatDialog;
66 //The timer class, used to refresh the timer in the app periodically,while playing/recording a clip.
68 //The MetaInfo viewing dialog class, used to view the Metadata info of a clip.
69 class CMVSViewMetaInfoDialog;
70 //The class provides the interface to set the video output screen.
71 class CMVSMultipleScreenDialog;
72 //This class used to register the application for AP&R
73 class CMVSResourceNotifyDialog;
75 class CMVSVideoControl;
77 //The main class that links to all the dialog windows in the application. This class implements the HandleCommandL()
78 //function that handles any input generated by the user on the UI,and calls the respective dialouge.It acts as an interface
79 //between all the dialouges and the user.Also this class is responsible for processing the commands and linking with
80 //the agents to the UI.
81 class CMVSAppUi : public CEikAppUi, MMVSClientObserver
87 void SetRepeats(TInt aNoRepeats, TTimeIntervalMicroSeconds aDelay);
88 void SetBalanceL(TInt aBalance);
89 void SetVolumeL(TInt aVolume, TTimeIntervalMicroSeconds aRamp);
90 //for audio aMediaType = 0; for video aMediaType = 1;
91 TInt GetExtensionListL(CDesCArrayFlat* aExtArray,TBool aMediaType);
92 //for audio aMediaType = 0; for video aMediaType = 1;
93 TInt GetPluginListL(TInt8 aExtIdx,CDesCArrayFlat* aExtArray,CDesCArrayFlat* aPluginArray,TBool aMediaType);
94 void SetMetaDataL(RPointerArray<CMMFMetaDataEntry> aMetaArray);
95 void GetMetaDataL(RPointerArray<CMMFMetaDataEntry>& aMetaArray);
96 void SelectedPluginIdx(TInt aIdx);
97 void SelectedExtension(TDesC16& aDes);
98 void GetSupportedBitRatesL(RArray <TUint>& aBitRateArray);
99 void GetSupportedSampleRatesArrayL(RArray<TUint>& aSampleRatesArray);
100 void GetSupportedNoChannelsArrayL(RArray<TUint>& aNoChannelsArray);
101 void GetSupportedCodecsArrayL(RArray<TFourCC>& aCodecsArray);
102 void SelectedMedia(TBool aMediaType);
103 void SetSampleRateL(TUint aSampleRate);
104 void SetChannelsL(TUint aNumberOfChannels);
105 void SetBitRateL(TUint aBitRate);
106 void SetCodecsL(TFourCC aDataType);
107 void GetSupportedFrameRatesL(RArray <TReal32>& aFrameRateArray);
108 void GetSupportedFrameSizeArrayL(RArray <TSize>& aFrameRateArray);
109 TInt GetSystemInfoL(CDesCArrayFlat* aPluginArray);
110 void SetVideoFrameRateL(TReal32 aFrameRate);
111 void SetVideoFrameSizeL(TSize aFrameSize);
112 void SetAudioEnabledL(TBool aAudioEnabled);
113 void SetRotationL(TVideoRotation aRotation);
115 void SetScaleFactorL(TReal32 aScaleWidth,TReal32 aScaleHeight,TBool aAntiAliasFiltering);
116 void GetScaleFactorL(TReal32& aScaleWidth, TReal32& aScaleHeight, TBool& aAntiAliasFiltering);
118 void SetCropRegionL(const TRect& aCropRegion);
119 void GetCropRegionL(TRect& aCropRegion);
121 void SetVideoExtent(const TRect& aVideoExtent);
122 void SetWindowClippingRect(const TRect& aWindowClipRect);
123 void SetOverlayTextL(const TDesC& aOverlayText);
124 const TDesC& OverlayText() const;
126 void SetAutoScaleL(TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos);
127 void GetAutoScale(TAutoScaleType& aScaleType, TInt& aHorizPos, TInt& aVertPos);
129 void GetSupportedVideoTypesL(CDesC8ArrayFlat& aMimeArray);
130 void SetVideoTypeL(const TDesC8 &aType);
131 void SetPriorityL(TInt aPriority, TMdaPriorityPreference aPriorityPreference);
132 void SetCropL(TTimeIntervalMicroSeconds aCropStart,TBool aCropFromBeginning);
133 TBool SetPlayWindow(TTimeIntervalMicroSeconds aStart,TTimeIntervalMicroSeconds aEnd);
134 void WriteAudioDataL(CMVSConfigAudioFormatDialog* apAudioFormat,
136 void WriteVideoDataL(CMVSConfigVideoFormatDialog* apVideoFormatDlg,
138 void UpdatePositionViewL();
139 void InternalizeL(RReadStream& aStream);
140 void ExternalizeL(RWriteStream& aStream);
141 void SetPosition(TTimeIntervalMicroSeconds& aPos);
142 void SetMaxFileSize(TInt& aVal);
143 void SetOutputScreen(TInt aScreenNumber);
144 void RegisterForNotification(TBool aRegisterd);
145 void SetPip(TBool aPip);
146 void SetCrp(TBool aCrp);
148 inline void FileOpenL();
149 inline void FileOpenForRecordL();
151 TTimeIntervalMicroSeconds GetCropStart() const;
152 TTimeIntervalMicroSeconds GetCropEnd() const;
153 void InitializeMetaArrayL();
154 TReal32 GetVideoFrameRateL();
155 void SaveAsDialogL();
156 void DetermineFinalFNameL();
157 TVideoRotation GetRotationL();
158 void LogErrors(TInt aError);
160 void HandleCommandL(TInt aCommand); //Handles command invocations
161 void BuildDollarDesFromArrayL(TDes& aDollarDes);
162 void PopulateInfoWindowDataL(TMVSState aState);
163 //from MMVSClientObserver
164 void UpdateStateChange(TMVSState aState, TInt aError);
165 void MvsResourceNotification(const TDesC8& aNotificationData);
166 //Dynamically alter the availability of controls in the menu by
167 // 'dimming' and 'undimming' them.
168 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); //Menu set-up
169 void UpdateDisplayL(TMVSState aState);
170 void ConvertTimeToDes(TTimeIntervalMicroSeconds aPosition,
172 TPoint DrawBorders(const TSize& aSize) const;
173 void StopViewFinder();
175 void PrepareVideoControlsL();
179 CMVSAppView* iAppView; //The application view
180 CMVSVolumeDialog* iVolumeDialog;
181 CMVSBalanceDialog* iBalanceDialog;
182 CMVSRepeatDialog* iRepeatDialog;
183 CMVSSelectPluginsDialog* iSelectPluginsDialog;
184 CDesCArrayFlat* iPluginArray; //Array of supported plugins
185 CDesCArrayFlat* iExtArray; //Array of supported Extensions
186 CDesCArrayFlat* iCodecArray;//Array of supported Codecs
187 CMVSSaveAsDialog* iSaveAsDialog;
188 // CMVSSetPriorityDialog* iSetAudioPriorityDialog;
189 CMVSEditMetaInfoDialog* iEditMetaInfoDialog;
190 CMVSViewMetaInfoDialog* iViewMetaInfoDialog;
191 CMVSConfigAudioFormatDialog* iConfigFormatDialog;
192 CMVSConfigVideoFormatDialog* iVideoFormatDialog;
193 CMVSSystemInfoDialog* iSystemInfo;
194 CMVSVideoSettingDialog* iVideoSetting;
195 CMVSAudioSettingDialog* iAudioSetting;
196 CMVSSetPlayWindowDialog* iSetPlayWindow;
199 RPointerArray<CMMFMetaDataEntry> iMetaArray;
200 CMMFMetaDataEntry* iMetaTitle;
201 CMMFMetaDataEntry* iMetaAuthor;
202 CMMFMetaDataEntry* iMetaCopyright;
203 CMMFMetaDataEntry* iMetaRevision;
204 CMMFMetaDataEntry* iMetaCategory;
205 CMMFMetaDataEntry* iMetaComments;
207 CDesCArrayFlat* iPluginNames;
208 CMVSAudioPlayAgent* iAudioPlayAgent;
209 CMVSAudioRecordAgent* iAudioRecordAgent;
210 CMVSVideoPlayAgent* iVideoPlayAgent;
211 CMVSVideoRecordAgent* iVideoRecordAgent;
212 CMVSControllerPluginInfo* iPluginInfo;
213 CMVSCropDialog* iCropDialog;
214 CMVSViewTicker* iViewTicker;
215 CMVSMultipleScreenDialog* iSetScreen;
216 CMVSResourceNotifyDialog* iRegisterForNotification;
217 CSettingsManager* iSettingManager;
218 RArray<TUid> iUidArray;
219 RArray<TUid> iAudioUidArray;
220 RArray<TUid> iAudioPlayUidArray;
221 RArray<TUid> iVideoUidArray;
222 TInt iSelectedPluginIdx;
226 TBuf<KMaxExtensionSize> iControllerExt;
229 TTimeIntervalMicroSeconds iRamp;
234 TMdaPriorityPreference iPriorityPreference;
236 TTimeIntervalMicroSeconds iStart;
237 TTimeIntervalMicroSeconds iEnd;
238 TTimeIntervalMicroSeconds iCropStart;
239 TTimeIntervalMicroSeconds iCropEnd;
240 TTimeIntervalMicroSeconds iCropPosition;
241 TTimeIntervalMicroSeconds iClipLength;
242 TBool iCropFromBeginning;
243 TFileName iDestFilename;
244 TTimeIntervalMicroSeconds iRepeatDelay;
245 TBuf<KMaxDisplayLabelSize> iDisplayState;
246 TFileName iDisplayFName;
247 TBuf<KMaxDisplayLabelSize> iDisplayTime;
248 CDesCArrayFlat iMainWindowText;
249 TBuf<KMaxDollarPaddingBufferSize> iDollarDes;
250 TTimeIntervalMicroSeconds iTimeElapsed;
251 TReal32 iVideoFrameRate;
252 TVideoRotation iVideoRotation;
256 TVideoRotation iRotation;
259 TTimeIntervalMicroSeconds iDuration;
261 TBool iOpeningForRecord;
265 CEikButtonGroupContainer* iButtons;
267 TBool iRecordLimitSet;
271 TBool iAlreadyRegistered;
274 TRect iWindowClipRect;
276 TAutoScaleType iAutoScaleType;
277 TInt iAutoScaleHorizPos;
278 TInt iAutoScaleVertPos;
282 TBool iVideoExtentSet;
283 TBool iWindowClipRectSet;
285 CMVSVideoControl* iVideoCtl;
286 // Controls displaying video, window owning
287 RPointerArray<CMVSVideoControl> iVideoCtls;