|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef XARECORDSESSIONIMPL_H |
|
43 #define XARECORDSESSIONIMPL_H |
|
44 |
|
45 #include <OpenMAXAL.h> |
|
46 #include <BADESCA.H> |
|
47 |
|
48 |
|
49 class XARecordObserver; |
|
50 class XARecordSessionImpl |
|
51 { |
|
52 public: |
|
53 XARecordSessionImpl(XARecordObserver &parent); |
|
54 ~XARecordSessionImpl(); |
|
55 TInt32 postConstruct(); |
|
56 |
|
57 /* For QMediaRecorderControl begin */ |
|
58 TInt32 setURI(const TDesC &aURI); |
|
59 TInt32 record(); |
|
60 TInt32 pause(); |
|
61 TInt32 stop(); |
|
62 TInt32 duration(TInt64 &aDur); |
|
63 /* For QMediaRecorderControl end */ |
|
64 |
|
65 void cbMediaRecorder(XAObjectItf caller, |
|
66 const void *pContext, |
|
67 XAuint32 event, |
|
68 XAresult result, |
|
69 XAuint32 param, |
|
70 void *pInterface); |
|
71 void cbRecordItf(XARecordItf caller, |
|
72 void *pContext, |
|
73 XAuint32 event); |
|
74 |
|
75 /* For QAudioEndpointSelector begin */ |
|
76 void getAudioInputDeviceNames(RArray<TPtrC> &aArray); |
|
77 TInt32 defaultAudioInputDevice(TPtrC &endPoint); |
|
78 TInt32 activeAudioInputDevice(TPtrC &endPoint); |
|
79 TBool setAudioInputDevice(const TDesC &aDevice); |
|
80 void cbAvailableAudioInputsChanged(XAAudioIODeviceCapabilitiesItf caller, |
|
81 void *pContext, |
|
82 XAuint32 deviceID, |
|
83 XAint32 numInputs, |
|
84 XAboolean isNew); |
|
85 /* For QAudioEndpointSelector end */ |
|
86 |
|
87 /* For QAudioEncoderControl begin */ |
|
88 const RArray<TPtrC>& getAudioEncoderNames(); |
|
89 TInt32 getSampleRates(const TDesC &aEncoder, |
|
90 RArray<TInt32> &aSampleRates, |
|
91 TBool &aIsContinuous); |
|
92 TInt32 getBitrates(const TDesC &aEncoder, |
|
93 RArray<TUint32> &aBitrates); |
|
94 /* For QAudioEncoderControl end */ |
|
95 |
|
96 /* For QMediaContainerControl begin */ |
|
97 const RArray<TPtrC>& getContainerNames(); |
|
98 const RArray<TPtrC>& getContainerDescs(); |
|
99 /* For QMediaContainerControl end */ |
|
100 |
|
101 void resetEncoderAttributes(); |
|
102 void setContainerType(const TDesC &aURI); |
|
103 TBool setCodec(const TDesC &aURI); |
|
104 void setBitRate(TUint32 aBitRate); |
|
105 void setChannels(TUint32 aChannels); |
|
106 void setOptimalChannelCount(); |
|
107 void setSampleRate(TUint32 aSampleRate); |
|
108 void setOptimalSampleRate(); |
|
109 TInt32 setCBRMode(); |
|
110 TInt32 setVBRMode(); |
|
111 void setVeryLowQuality(); |
|
112 void setLowQuality(); |
|
113 void setNormalQuality(); |
|
114 void setHighQuality(); |
|
115 void setVeryHighQuality(); |
|
116 |
|
117 private: |
|
118 TInt32 createMediaRecorderObject(); |
|
119 TInt32 mapError(XAresult xa_err, |
|
120 TBool debPrn); |
|
121 TInt32 initContainersList(); |
|
122 TInt32 initAudioEncodersList(); |
|
123 TInt32 initAudioInputDevicesList(); |
|
124 TInt32 setEncoderSettingsToMediaRecorder(); |
|
125 TInt32 getBitratesByAudioCodecID(XAuint32 encoderId, |
|
126 RArray<TUint32> &aBitrates); |
|
127 |
|
128 |
|
129 private: |
|
130 XARecordObserver &m_Parent; |
|
131 XAObjectItf m_EOEngine; |
|
132 XAObjectItf m_MORecorder; |
|
133 XARecordItf m_RecordItf; |
|
134 XAAudioEncoderItf m_AudioEncItf; |
|
135 /* Audio Source */ |
|
136 XADataSource m_DataSource; |
|
137 XADataLocator_IODevice m_LocatorMic; |
|
138 XADataFormat_MIME m_Mime; |
|
139 XADataLocator_URI m_Uri; |
|
140 /*Audio Sink*/ |
|
141 XADataSink m_DataSink; |
|
142 HBufC8 *m_WAVMime; |
|
143 |
|
144 /* Set by client*/ |
|
145 HBufC8 *m_URIName; |
|
146 XAuint32 m_AudioEncoderId; |
|
147 XAuint32 m_InputDeviceId; |
|
148 XAuint32 m_ContainerType; |
|
149 XAuint32 m_BitRate; |
|
150 XAuint32 m_RateControl; |
|
151 XAuint32 m_ProfileSetting; |
|
152 XAuint32 m_ChannelsOut; |
|
153 XAuint32 m_SampleRate; |
|
154 |
|
155 /* For QAudioEndpointSelector begin */ |
|
156 XAAudioIODeviceCapabilitiesItf m_AudioIODevCapsItf; |
|
157 RArray<TUint32> m_InputDeviceIDs; |
|
158 CDesC16ArrayFlat *m_AudioInputDeviceNames; |
|
159 RArray<TUint32> m_DefaultInputDeviceIDs; |
|
160 CDesC16ArrayFlat *m_DefaultAudioInputDeviceNames; |
|
161 /* For QAudioEndpointSelector end */ |
|
162 |
|
163 /* For QAudioEncoderControl begin */ |
|
164 XAAudioEncoderCapabilitiesItf m_AudioEncCapsItf; |
|
165 RArray<XAuint32> m_EncoderIds; |
|
166 RArray<TPtrC> m_EncoderNames; |
|
167 RArray<TPtrC> m_ContainerNames; |
|
168 RArray<TPtrC> m_ContainerDescs; |
|
169 /* For QAudioEncoderControl begin */ |
|
170 }; |
|
171 |
|
172 #endif /* XARECORDSESSIONIMPL_H */ |