author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:31:01 +0100 | |
branch | RCL_3 |
changeset 33 | bc78a40cd63c |
parent 32 | 73a1feb507fb |
permissions | -rw-r--r-- |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
// USER |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include "musenglivesession.h" |
33 | 21 |
#include "musengsessionobserver.h" |
22 |
#include "musenglivesessionobserver.h" |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "musunittesting.h" |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "musengmceutils.h" |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "musenglogger.h" |
33 | 26 |
#include "mussettings.h" |
27 |
#include "musengorientationhandler.h" |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
// SYSTEM |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include <mcemanager.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <mcecamerasource.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <mcevideostream.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include <mcertpsink.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include <mcedisplaysink.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include <mcefilesink.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include <mcesession.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include <mcevideocodec.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include <mceh263codec.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include <mceavccodec.h> |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
|
33 | 41 |
const TInt KMaxBrightness = 100; |
42 |
const TInt KMinBrightness = -100; |
|
43 |
const TInt KBrightnessStepSize = 10; |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
33 | 45 |
// Names of AVC levels in string for config keys stored in CenRep |
46 |
_LIT8( KMusAvcBitrateLevel1, "AvcBrL1=" ); |
|
47 |
_LIT8( KMusAvcBitrateLevel1b, "AvcBrL1b=" ); |
|
48 |
_LIT8( KMusAvcBitrateLevel1_1, "AvcBrL1_1=" ); |
|
49 |
_LIT8( KMusAvcBitrateLevel1_2, "AvcBrL1_2=" ); |
|
50 |
_LIT8( KMusAvcBitrateLevel1_3, "AvcBrL1_3=" ); |
|
51 |
_LIT8( KMusAvcBitrateLevel2, "AvcBrL2=" ); |
|
52 |
||
53 |
_LIT8( KMusEncoderInfoTokenizer, ";" ); |
|
54 |
||
55 |
//Number of big and small zoom steps on Zoom scale |
|
56 |
const TInt KZoomBigStepCount = 15; |
|
57 |
const TInt KZoomSmallStepCount = KZoomBigStepCount*2; |
|
58 |
const TInt KZoomStepMinSize = 1; |
|
59 |
||
60 |
const TInt64 KZoomFasterTime = 333333; // 1/3 second |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
// |
33 | 66 |
EXPORT_C CMusEngLiveSession* CMusEngLiveSession::NewL( |
67 |
const TDesC& aFileName, |
|
68 |
const TRect& aRect, |
|
69 |
MMusEngSessionObserver& aSessionObserver, |
|
70 |
MMusEngOutSessionObserver& aOutSessionObserver, |
|
71 |
MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
72 |
TUint aSipProfileId ) |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
{ |
33 | 74 |
CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( |
75 |
aSessionObserver, |
|
76 |
aOutSessionObserver, |
|
77 |
aLiveSessionObserver, |
|
78 |
aRect, |
|
79 |
aFileName ); |
|
80 |
CleanupStack::PushL( self ); |
|
81 |
self->ConstructL( aSipProfileId ); |
|
82 |
CleanupStack::Pop( self ); |
|
83 |
return self; |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
|
33 | 86 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
// |
33 | 91 |
EXPORT_C CMusEngLiveSession* CMusEngLiveSession::NewL( |
92 |
const TRect& aRect, |
|
93 |
MMusEngSessionObserver& aSessionObserver, |
|
94 |
MMusEngOutSessionObserver& aOutSessionObserver, |
|
95 |
MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
96 |
TUint aSipProfileId ) |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
{ |
33 | 98 |
CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( |
99 |
aSessionObserver, |
|
100 |
aOutSessionObserver, |
|
101 |
aLiveSessionObserver, |
|
102 |
aRect ); |
|
103 |
CleanupStack::PushL( self ); |
|
104 |
self->ConstructL( aSipProfileId ); |
|
105 |
CleanupStack::Pop( self ); |
|
106 |
return self; |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
|
33 | 109 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
CMusEngLiveSession::~CMusEngLiveSession() |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
{ |
33 | 116 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::~CMusEngLiveSession()" ) |
117 |
||
118 |
delete iOrientationHandler; |
|
119 |
||
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::~CMusEngLiveSession()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
|
33 | 123 |
|
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// |
|
128 |
EXPORT_C TInt CMusEngLiveSession::CurrentZoomL() const |
|
129 |
{ |
|
130 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CurrentZoomL()" ) |
|
131 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
132 |
||
133 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
134 |
||
135 |
TInt currentZoom = camera->ZoomFactorL() + camera->DigitalZoomFactorL(); |
|
136 |
||
137 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::CurrentZoomL( %d )", |
|
138 |
currentZoom ) |
|
139 |
||
140 |
return currentZoom; |
|
141 |
} |
|
142 |
||
143 |
||
144 |
// ----------------------------------------------------------------------------- |
|
145 |
// |
|
146 |
// ----------------------------------------------------------------------------- |
|
147 |
// |
|
148 |
EXPORT_C void CMusEngLiveSession::SetZoomL( TInt aNewZoomFactor ) |
|
149 |
{ |
|
150 |
MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::SetZoomL( %d )", |
|
151 |
aNewZoomFactor ) |
|
152 |
||
153 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
154 |
__ASSERT_ALWAYS( aNewZoomFactor <= MaxZoomL() && |
|
155 |
aNewZoomFactor >= MinZoomL(), |
|
156 |
User::Leave( KErrArgument ) ); |
|
157 |
||
158 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
159 |
||
160 |
if ( aNewZoomFactor < iCameraInfo.iMaxZoom ) |
|
161 |
{ |
|
162 |
MUS_LOG( "mus: [ENGINE] Optical zoom factor increased" ) |
|
163 |
camera->SetZoomFactorL( aNewZoomFactor ); |
|
164 |
} |
|
165 |
||
166 |
if ( aNewZoomFactor - iCameraInfo.iMaxZoom >= 0 ) |
|
167 |
{ |
|
168 |
camera->SetDigitalZoomFactorL( aNewZoomFactor - iCameraInfo.iMaxZoom ); |
|
169 |
MUS_LOG1( "mus: [ENGINE] Digital zoom factor increased to %d", |
|
170 |
aNewZoomFactor - iCameraInfo.iMaxZoom ) |
|
171 |
} |
|
172 |
||
173 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetZoomL()" ) |
|
174 |
} |
|
175 |
||
176 |
||
177 |
// ----------------------------------------------------------------------------- |
|
178 |
// |
|
179 |
// ----------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
EXPORT_C TInt CMusEngLiveSession::MinZoomL() const |
|
182 |
{ |
|
183 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MinZoomL()" ) |
|
184 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
185 |
||
186 |
// Although we do not need camera for return value, we have to have it in |
|
187 |
// order to have proper iCameraInfo |
|
188 |
MusEngMceUtils::GetCameraL( *iSession ); |
|
189 |
||
190 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MinZoomL( %d )", |
|
191 |
iCameraInfo.iMinZoom ) |
|
192 |
||
193 |
return iCameraInfo.iMinZoom; |
|
194 |
} |
|
195 |
||
196 |
||
197 |
// ----------------------------------------------------------------------------- |
|
198 |
// |
|
199 |
// ----------------------------------------------------------------------------- |
|
200 |
// |
|
201 |
EXPORT_C TInt CMusEngLiveSession::MaxZoomL() const |
|
202 |
{ |
|
203 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MaxZoomL()" ) |
|
204 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
205 |
||
206 |
// Although we do not need camera for return value, we have to have it in |
|
207 |
// order to have proper iCameraInfo |
|
208 |
MusEngMceUtils::GetCameraL( *iSession ); |
|
209 |
||
210 |
TInt maxZoom = iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom; |
|
211 |
||
212 |
MUS_LOG1( "mus: [ENGINE] Max optical zoom( %d )", |
|
213 |
iCameraInfo.iMaxZoom ) |
|
214 |
MUS_LOG1( "mus: [ENGINE] Max digital zoom( %d )", |
|
215 |
iCameraInfo.iMaxDigitalZoom ) |
|
216 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MaxZoomL( %d )", |
|
217 |
maxZoom ) |
|
218 |
||
219 |
return maxZoom; |
|
220 |
} |
|
221 |
||
222 |
||
223 |
// ----------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
// ----------------------------------------------------------------------------- |
|
226 |
// |
|
227 |
EXPORT_C void CMusEngLiveSession::ZoomInL() |
|
228 |
{ |
|
229 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomInL()" ) |
|
230 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
231 |
||
232 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
233 |
||
234 |
// First try to increase optical zoom factor. If in maximum value, try to |
|
235 |
// increase digital zoom factor. |
|
236 |
TInt stepSize = ZoomStepSize( iZoomInTime ); |
|
237 |
TInt zoomFactor = camera->ZoomFactorL(); |
|
238 |
TInt zoomDigitalFactor = camera->DigitalZoomFactorL(); |
|
239 |
||
240 |
//increate optical zoom factor |
|
241 |
if ( zoomFactor + stepSize <= iCameraInfo.iMaxZoom ) |
|
242 |
{ |
|
243 |
//optical zoom factor is enough |
|
244 |
camera->SetZoomFactorL( zoomFactor + stepSize ); |
|
245 |
stepSize = 0; |
|
246 |
} |
|
247 |
else if (zoomFactor < iCameraInfo.iMaxZoom) |
|
248 |
{ |
|
249 |
stepSize -= iCameraInfo.iMaxZoom - zoomFactor; |
|
250 |
camera->SetZoomFactorL( iCameraInfo.iMaxZoom ); |
|
251 |
} |
|
252 |
||
253 |
//increate digital zoom factor |
|
254 |
if (stepSize > 0) |
|
255 |
{ |
|
256 |
if ( zoomDigitalFactor + stepSize <= iCameraInfo.iMaxDigitalZoom ) |
|
257 |
{ |
|
258 |
camera->SetDigitalZoomFactorL( zoomDigitalFactor + stepSize ); |
|
259 |
} |
|
260 |
else |
|
261 |
{ |
|
262 |
camera->SetDigitalZoomFactorL( iCameraInfo.iMaxDigitalZoom ); |
|
263 |
MUS_LOG( "mus: [ENGINE] CMusEngLiveSession::ZoomInL(): Optical \ |
|
264 |
and digital zoom factors are in maximum value" ) |
|
265 |
} |
|
266 |
} |
|
267 |
||
268 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomInL()" ) |
|
269 |
||
270 |
} |
|
271 |
||
272 |
||
273 |
// ----------------------------------------------------------------------------- |
|
274 |
// |
|
275 |
// ----------------------------------------------------------------------------- |
|
276 |
// |
|
277 |
EXPORT_C void CMusEngLiveSession::ZoomOutL() |
|
278 |
{ |
|
279 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomOutL()" ) |
|
280 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
281 |
||
282 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
283 |
||
284 |
// First try to decrease digital zoom factor. If already zero, try to |
|
285 |
// decrease optical zoom factor. |
|
286 |
TInt stepSize = ZoomStepSize( iZoomOutTime ); |
|
287 |
TInt zoomFactor = camera->ZoomFactorL(); |
|
288 |
TInt zoomDigitalFactor = camera->DigitalZoomFactorL(); |
|
289 |
||
290 |
//decreate digital zoom factor firstly |
|
291 |
if ( zoomDigitalFactor - stepSize >= 0 ) |
|
292 |
{ |
|
293 |
//digital zoom factor is enough |
|
294 |
camera->SetDigitalZoomFactorL( zoomDigitalFactor - stepSize ); |
|
295 |
stepSize = 0; |
|
296 |
} |
|
297 |
else if ( zoomDigitalFactor > 0 ) |
|
298 |
{ |
|
299 |
stepSize -= zoomDigitalFactor; |
|
300 |
camera->SetDigitalZoomFactorL( 0 ); |
|
301 |
MUS_LOG("mus: [ENGINE] Digigal Factor to zero") |
|
302 |
} |
|
303 |
||
304 |
//decreate optical zoom factor firstly |
|
305 |
if ( stepSize > 0 ) |
|
306 |
{ |
|
307 |
if ( zoomFactor - stepSize > iCameraInfo.iMinZoom ) |
|
308 |
{ |
|
309 |
camera->SetZoomFactorL( zoomFactor - stepSize ); |
|
310 |
} |
|
311 |
else |
|
312 |
{ |
|
313 |
MUS_LOG( "mus: [ENGINE] CMusEngLiveSession::ZoomOutL(): Optical and \ |
|
314 |
digital zoom factors are in minimum value" ) |
|
315 |
camera->SetZoomFactorL( iCameraInfo.iMinZoom ); |
|
316 |
} |
|
317 |
} |
|
318 |
||
319 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomOutL()" ) |
|
320 |
} |
|
321 |
||
322 |
||
323 |
// ----------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
// ----------------------------------------------------------------------------- |
|
326 |
// |
|
327 |
EXPORT_C void CMusEngLiveSession::ZoomDefaultL() |
|
328 |
{ |
|
329 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomDefaultL()" ) |
|
330 |
||
331 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
332 |
||
333 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
334 |
||
335 |
camera->SetZoomFactorL( iDefaultZoomFactor ); |
|
336 |
camera->SetDigitalZoomFactorL( 0 ); |
|
337 |
||
338 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomDefaultL()" ) |
|
339 |
} |
|
340 |
||
341 |
||
342 |
// ----------------------------------------------------------------------------- |
|
343 |
// |
|
344 |
// ----------------------------------------------------------------------------- |
|
345 |
// |
|
346 |
EXPORT_C void CMusEngLiveSession::SetBrightnessL( TInt aBrightness ) const |
|
347 |
{ |
|
348 |
MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::SetBrightnessL( %d )", |
|
349 |
aBrightness ) |
|
350 |
||
351 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
352 |
||
353 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
354 |
camera->SetBrightnessL( aBrightness ); |
|
355 |
||
356 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetBrightnessL()" ) |
|
357 |
} |
|
358 |
||
359 |
||
360 |
// ----------------------------------------------------------------------------- |
|
361 |
// |
|
362 |
// ----------------------------------------------------------------------------- |
|
363 |
// |
|
364 |
EXPORT_C TInt CMusEngLiveSession::CurrentBrightnessL() const |
|
365 |
{ |
|
366 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CurrentBrightnessL()" ) |
|
367 |
||
368 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
369 |
||
370 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
371 |
TInt currentBrightness = camera->BrightnessL(); |
|
372 |
||
373 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::CurrentBrightnessL(): %d", |
|
374 |
currentBrightness ) |
|
375 |
||
376 |
return currentBrightness; |
|
377 |
} |
|
378 |
||
379 |
||
380 |
// ----------------------------------------------------------------------------- |
|
381 |
// |
|
382 |
// ----------------------------------------------------------------------------- |
|
383 |
// |
|
384 |
EXPORT_C TInt CMusEngLiveSession::MaxBrightnessL() const |
|
385 |
{ |
|
386 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MaxBrightnessL()" ) |
|
387 |
||
388 |
// maximum brightness is not in camera info, but a constant 100 |
|
389 |
||
390 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MaxBrightnessL(): %d", |
|
391 |
KMaxBrightness ) |
|
392 |
||
393 |
return KMaxBrightness; |
|
394 |
} |
|
395 |
||
396 |
||
397 |
// ----------------------------------------------------------------------------- |
|
398 |
// |
|
399 |
// ----------------------------------------------------------------------------- |
|
400 |
// |
|
401 |
EXPORT_C TInt CMusEngLiveSession::MinBrightnessL() const |
|
402 |
{ |
|
403 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MinBrightnessL()" ) |
|
404 |
||
405 |
// maximum brightness is not in camera info, but a constant -100 |
|
406 |
||
407 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MinBrightnessL(): %d", |
|
408 |
KMinBrightness ) |
|
409 |
||
410 |
return KMinBrightness; |
|
411 |
} |
|
412 |
||
413 |
||
414 |
// ----------------------------------------------------------------------------- |
|
415 |
// |
|
416 |
// ----------------------------------------------------------------------------- |
|
417 |
// |
|
418 |
EXPORT_C void CMusEngLiveSession::IncreaseBrightnessL() |
|
419 |
{ |
|
420 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::IncreaseBrightnessL()" ) |
|
421 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
422 |
||
423 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
424 |
||
425 |
TInt newBrightness = camera->BrightnessL() + KBrightnessStepSize; |
|
426 |
||
427 |
if ( newBrightness < KMaxBrightness ) |
|
428 |
{ |
|
429 |
camera->SetBrightnessL( newBrightness ); |
|
430 |
} |
|
431 |
else |
|
432 |
{ |
|
433 |
camera->SetBrightnessL( KMaxBrightness ); |
|
434 |
} |
|
435 |
||
436 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::IncreaseBrightnessL()" ) |
|
437 |
} |
|
438 |
||
439 |
||
440 |
// ----------------------------------------------------------------------------- |
|
441 |
// |
|
442 |
// ----------------------------------------------------------------------------- |
|
443 |
// |
|
444 |
EXPORT_C void CMusEngLiveSession::DecreaseBrightnessL() |
|
445 |
{ |
|
446 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::DecreaseBrightnessL()" ) |
|
447 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
448 |
||
449 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
450 |
||
451 |
TInt newBrightness = camera->BrightnessL() - KBrightnessStepSize; |
|
452 |
||
453 |
if ( newBrightness > KMinBrightness ) |
|
454 |
{ |
|
455 |
camera->SetBrightnessL( newBrightness ); |
|
456 |
} |
|
457 |
else |
|
458 |
{ |
|
459 |
camera->SetBrightnessL( KMinBrightness ); |
|
460 |
} |
|
461 |
||
462 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::DecreaseBrightnessL()" ) |
|
463 |
} |
|
464 |
||
465 |
||
466 |
// ----------------------------------------------------------------------------- |
|
467 |
// |
|
468 |
// ----------------------------------------------------------------------------- |
|
469 |
// |
|
470 |
EXPORT_C void CMusEngLiveSession::BrightnessDefaultL() |
|
471 |
{ |
|
472 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::BrightnessDefaultL()" ) |
|
473 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
474 |
||
475 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
476 |
||
477 |
camera->SetBrightnessL( iDefaultBrightness ); |
|
478 |
||
479 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::BrightnessDefaultL()" ) |
|
480 |
} |
|
481 |
||
482 |
||
483 |
// ----------------------------------------------------------------------------- |
|
484 |
// |
|
485 |
// ----------------------------------------------------------------------------- |
|
486 |
// |
|
487 |
EXPORT_C void CMusEngLiveSession::BrightnessAutoL() |
|
488 |
{ |
|
489 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::BrightnessAutoL()" ) |
|
490 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
491 |
||
492 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
493 |
||
494 |
camera->SetBrightnessL( CCamera::EBrightnessAuto ); |
|
495 |
||
496 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::BrightnessAutoL()" ) |
|
497 |
} |
|
498 |
||
499 |
||
500 |
// ----------------------------------------------------------------------------- |
|
501 |
// |
|
502 |
// ----------------------------------------------------------------------------- |
|
503 |
// |
|
504 |
EXPORT_C void CMusEngLiveSession::RecordL( TBool aRecord ) |
|
505 |
{ |
|
506 |
MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::RecordL( %d )", aRecord ) |
|
507 |
||
508 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
509 |
||
510 |
CMceMediaSink* fileSink = MusEngMceUtils::GetMediaSink( *iSession, |
|
511 |
KMceFileSink ); |
|
512 |
||
513 |
__ASSERT_ALWAYS( fileSink, User::Leave( KErrNotReady ) ); |
|
514 |
||
515 |
if( aRecord && !fileSink->IsEnabled() ) |
|
516 |
{ |
|
517 |
fileSink->EnableL(); |
|
518 |
} |
|
519 |
else if ( !aRecord && fileSink->IsEnabled() ) |
|
520 |
{ |
|
521 |
fileSink->DisableL(); |
|
522 |
} |
|
523 |
else |
|
524 |
{ |
|
525 |
// NOP |
|
526 |
} |
|
527 |
||
528 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::RecordL( %d )", aRecord ) |
|
529 |
} |
|
530 |
||
531 |
||
532 |
// ----------------------------------------------------------------------------- |
|
533 |
// |
|
534 |
// ----------------------------------------------------------------------------- |
|
535 |
// |
|
536 |
EXPORT_C TBool CMusEngLiveSession::IsRecording() |
|
537 |
{ |
|
538 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::IsRecording()" ) |
|
539 |
||
540 |
TBool isRecording( EFalse ); |
|
541 |
||
542 |
CMceMediaSink* fileSink = MusEngMceUtils::GetMediaSink( *iSession, |
|
543 |
KMceFileSink ); |
|
544 |
if ( fileSink ) |
|
545 |
{ |
|
546 |
isRecording = fileSink->IsEnabled(); |
|
547 |
} |
|
548 |
||
549 |
MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::IsRecording(%d)", |
|
550 |
isRecording ) |
|
551 |
||
552 |
return isRecording; |
|
553 |
} |
|
554 |
||
555 |
||
556 |
// ----------------------------------------------------------------------------- |
|
557 |
// Enable camera if not already enabled |
|
558 |
// ----------------------------------------------------------------------------- |
|
559 |
// |
|
560 |
EXPORT_C void CMusEngLiveSession::PlayL() |
|
561 |
{ |
|
562 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::PlayL()" ) |
|
563 |
||
564 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
565 |
||
566 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
567 |
||
568 |
if ( !camera->IsEnabled() ) |
|
569 |
{ |
|
570 |
camera->EnableL(); |
|
571 |
} |
|
572 |
else |
|
573 |
{ |
|
574 |
MUS_LOG( "mus: [ENGINE] Camera already enabled, ignore request" ) |
|
575 |
} |
|
576 |
||
577 |
iOrientationHandler->UpdateL(); |
|
578 |
||
579 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PlayL()" ) |
|
580 |
} |
|
581 |
||
582 |
||
583 |
// ----------------------------------------------------------------------------- |
|
584 |
// Disable camera if not already disabled |
|
585 |
// ----------------------------------------------------------------------------- |
|
586 |
// |
|
587 |
EXPORT_C void CMusEngLiveSession::PauseL() |
|
588 |
{ |
|
589 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::PauseL()" ) |
|
590 |
||
591 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
592 |
||
593 |
CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
594 |
||
595 |
if ( camera->IsEnabled() ) |
|
596 |
{ |
|
597 |
camera->DisableL(); |
|
598 |
} |
|
599 |
else |
|
600 |
{ |
|
601 |
MUS_LOG( "mus: [ENGINE] Camera already disabled, ignore request" ) |
|
602 |
} |
|
603 |
||
604 |
iOrientationHandler->UpdateL(); |
|
605 |
||
606 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PauseL()" ) |
|
607 |
} |
|
608 |
||
609 |
||
610 |
// ----------------------------------------------------------------------------- |
|
611 |
// |
|
612 |
// ----------------------------------------------------------------------------- |
|
613 |
// |
|
614 |
EXPORT_C TBool CMusEngLiveSession::IsPlayingL() |
|
615 |
{ |
|
616 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
617 |
||
618 |
return ( MusEngMceUtils::GetCameraL( *iSession )->IsEnabled() ); |
|
619 |
} |
|
620 |
||
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
// ----------------------------------------------------------------------------- |
33 | 622 |
// |
623 |
// ----------------------------------------------------------------------------- |
|
624 |
// |
|
625 |
void CMusEngLiveSession::EnableDisplayL( TBool aEnable ) |
|
626 |
{ |
|
627 |
CMusEngMceSession::EnableDisplayL( aEnable ); |
|
628 |
iOrientationHandler->UpdateL(); |
|
629 |
} |
|
630 |
||
631 |
// ----------------------------------------------------------------------------- |
|
632 |
// |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
// |
33 | 635 |
void CMusEngLiveSession::RefreshOrientationL() |
636 |
{ |
|
637 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::RefreshOrientationL()" ) |
|
638 |
||
639 |
iOrientationHandler->RefreshOrientationL(); |
|
640 |
||
641 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::RefreshOrientationL()" ) |
|
642 |
} |
|
643 |
||
644 |
// ----------------------------------------------------------------------------- |
|
645 |
// |
|
646 |
// ----------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
void CMusEngLiveSession::InitializeZoomStepSize() |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
{ |
33 | 650 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::InitializeZoomStepSize()" ) |
651 |
||
652 |
iBigZoomStep = ( iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom - |
|
653 |
iCameraInfo.iMinZoom ) / KZoomBigStepCount; |
|
654 |
||
655 |
if ( iBigZoomStep < KZoomStepMinSize ) |
|
656 |
iBigZoomStep = KZoomStepMinSize; |
|
657 |
||
658 |
iSmallZoomStep = ( iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom - |
|
659 |
iCameraInfo.iMinZoom ) / KZoomSmallStepCount; |
|
660 |
||
661 |
if ( iSmallZoomStep < KZoomStepMinSize ) |
|
662 |
iSmallZoomStep = KZoomStepMinSize; |
|
663 |
||
664 |
MUS_LOG2( "mus: [ENGINE] iSmallZoomStep = %d, iBigZoomStep = %d", |
|
665 |
iSmallZoomStep, iBigZoomStep ) |
|
666 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::InitializeZoomStepSize()" ) |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
667 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
668 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
669 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
670 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
671 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
672 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
673 |
void CMusEngLiveSession::CompleteSessionStructureL( |
33 | 674 |
CMceStreamBundle& /*aLocalBundle*/ ) |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
675 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
676 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CompleteSessionStructureL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
677 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
678 |
__ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
679 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
680 |
// Create outgoing video stream |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
681 |
CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
682 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
683 |
CMceRtpSink* rtpsink = CMceRtpSink::NewLC(); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
684 |
videoStream->AddSinkL( rtpsink ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
685 |
CleanupStack::Pop( rtpsink ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
686 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
687 |
CMceCameraSource* camera = CMceCameraSource::NewLC( *iManager ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
688 |
camera->DisableL(); // Start session in pause mode. |
33 | 689 |
camera->GetCameraInfo( iCameraInfo ); |
690 |
iDefaultZoomFactor = camera->ZoomFactorL(); |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
691 |
|
33 | 692 |
InitializeZoomStepSize(); |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
693 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
694 |
videoStream->SetSourceL( camera ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
695 |
CleanupStack::Pop( camera ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
696 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
697 |
iSession->AddStreamL( videoStream ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
698 |
CleanupStack::Pop( videoStream ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
699 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
700 |
// Construct recording stream if needed |
33 | 701 |
if ( iRecordedFile != KNullDesC ) |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
702 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
703 |
CMceVideoStream* streamForRecording = CMceVideoStream::NewLC(); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
704 |
|
33 | 705 |
CMceFileSink* fileSink = CMceFileSink::NewLC( iRecordedFile ); |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
706 |
fileSink->DisableL(); // Start in not recording mode |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
707 |
streamForRecording->AddSinkL( fileSink ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
708 |
CleanupStack::Pop( fileSink ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
709 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
710 |
streamForRecording->SetSourceL( camera ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
711 |
iSession->AddStreamL( streamForRecording ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
712 |
CleanupStack::Pop( streamForRecording ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
713 |
} |
33 | 714 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
715 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::CompleteSessionStructureL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
716 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
717 |
|
33 | 718 |
|
719 |
// ----------------------------------------------------------------------------- |
|
720 |
// |
|
721 |
// ----------------------------------------------------------------------------- |
|
722 |
// |
|
723 |
void CMusEngLiveSession::HandleSessionStateChanged( |
|
724 |
CMceSession& aSession, |
|
725 |
TInt aStatusCode, |
|
726 |
const TDesC8& aReasonPhrase ) |
|
727 |
{ |
|
728 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::HandleSessionStateChanged" ) |
|
729 |
||
730 |
MUS_ENG_LOG_SESSION_STATE_AND_STATUS( aSession, aStatusCode, aReasonPhrase ) |
|
731 |
||
732 |
if ( iSession && |
|
733 |
iSession == &aSession && |
|
734 |
aSession.State() == CMceSession::EEstablished && |
|
735 |
iStoreEncoderConfigInfo ) |
|
736 |
{ |
|
737 |
iStoreEncoderConfigInfo = EFalse; |
|
738 |
TRAPD( error, StoreEncoderConfigInfoL() ) |
|
739 |
if ( error != KErrNone && error != KErrNotFound ) |
|
740 |
{ |
|
741 |
// Only acceptable error is absence of repository entry, |
|
742 |
// otherwise we inform user about failed session. |
|
743 |
iSessionObserver.SessionFailed(); |
|
744 |
} |
|
745 |
} |
|
746 |
||
747 |
CMusEngMceSession::HandleSessionStateChanged( aSession, |
|
748 |
aStatusCode, |
|
749 |
aReasonPhrase ); |
|
750 |
||
751 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::HandleSessionStateChanged" ) |
|
752 |
} |
|
753 |
||
754 |
||
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
755 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
756 |
// Sets video codec attributes |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
757 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
758 |
// |
33 | 759 |
void CMusEngLiveSession::AdjustVideoCodecL( CMceVideoCodec& aVideoCodec ) |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
760 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
761 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::AdjustVideoCodecL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
762 |
|
33 | 763 |
CMusEngMceOutSession::AdjustVideoCodecL( aVideoCodec ); |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
764 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
765 |
// Starting with 80Kbps will give better quality than starting with |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
766 |
// 64kbps.And if network behaves bad than anyhow we will drop down or |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
767 |
// if network is good guy than we climp up to 128. |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
768 |
// Esp in operator variance. No constant defined in MCE so defining |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
769 |
// one here. |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
770 |
const TInt KMushInitialBitrate = 80000; |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
771 |
MUS_LOG1( "mus: [ENGINE] - Intial bit rate set to %d",KMushInitialBitrate); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
772 |
User::LeaveIfError( aVideoCodec.SetBitrate( KMushInitialBitrate ) ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
773 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
774 |
if ( aVideoCodec.SdpName() == KMceSDPNameH263() || |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
775 |
aVideoCodec.SdpName() == KMceSDPNameH2632000() ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
776 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
777 |
// Set H.263 codec to allow all bitrates, set maximum to level 45 and |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
778 |
// start using level 10 and let the rate control raise it if possible |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
779 |
// Label:H263 |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
780 |
User::LeaveIfError( aVideoCodec.SetAllowedBitrates( |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
781 |
KMceAllowedH263BitrateAll ) ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
782 |
aVideoCodec.SetMaxBitrateL( KMceH263Level45Bitrate ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
783 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
784 |
else if ( aVideoCodec.SdpName() == KMceSDPNameH264() ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
785 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
786 |
User::LeaveIfError( aVideoCodec.SetAllowedBitrates( |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
787 |
KMceAvcCodecProfileIdBaseline | |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
788 |
KMceAvcCodecProfileIopConstraintSet | |
33 | 789 |
KMceAvcBitrateLevel1b ) ); |
790 |
||
791 |
SetCodecConfigKeyL( aVideoCodec ); |
|
792 |
SetEncodingDeviceL( aVideoCodec ); |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
793 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
794 |
else |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
795 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
796 |
// NOP |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
797 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
798 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
799 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::AdjustVideoCodecL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
800 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
801 |
|
33 | 802 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
803 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
804 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
805 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
806 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
807 |
void CMusEngLiveSession::AdjustAudioCodecL( CMceAudioCodec& aAudioCodec ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
808 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
809 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::AdjustAudioCodecL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
810 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
811 |
CMusEngMceOutSession::AdjustAudioCodecL( aAudioCodec ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
812 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
813 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::AdjustAudioCodecL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
814 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
815 |
|
33 | 816 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
817 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
818 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
819 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
820 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
821 |
void CMusEngLiveSession::DoCodecSelectionL( CMceVideoStream& aVideoStream ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
822 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
823 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::DoCodecSelectionL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
824 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
825 |
CMusEngMceSession::DoCodecSelectionL( aVideoStream ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
826 |
|
33 | 827 |
if ( iVideoCodecList && |
828 |
iVideoCodecList->Length() > 0 && |
|
829 |
iVideoCodecList->FindF( KMceSDPNameH264 ) == KErrNotFound ) |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
830 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
831 |
// We know that recipient doesn't support AVC, so we do not offer it |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
832 |
const RPointerArray<CMceVideoCodec>& codecs = aVideoStream.Codecs(); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
833 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
834 |
for ( TInt codecIndex = 0; codecIndex < codecs.Count(); ++codecIndex ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
835 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
836 |
if ( codecs[codecIndex]->SdpName() == KMceSDPNameH264() ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
837 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
838 |
aVideoStream.RemoveCodecL( *codecs[codecIndex] ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
839 |
// Since succesfull removal of a codec has changed the |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
840 |
// indexing, we have to reset the index |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
841 |
codecIndex = 0; |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
842 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
843 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
844 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
845 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
846 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::DoCodecSelectionL()" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
847 |
} |
33 | 848 |
|
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
849 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
850 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
851 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
852 |
// ----------------------------------------------------------------------------- |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
853 |
// |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
854 |
void CMusEngLiveSession::StreamStateChanged( CMceMediaStream& aStream, |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
855 |
CMceMediaSink& aSink ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
856 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
857 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::StreamStateChanged( sink )" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
858 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
859 |
if ( !iSession ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
860 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
861 |
return; |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
862 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
863 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
864 |
MUS_ENG_LOG_STREAM_STATE( aStream ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
865 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
866 |
CMceVideoStream* recordingStream = |
33 | 867 |
MusEngMceUtils::GetRecordingStream( *iSession ); |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
868 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
869 |
if ( recordingStream && |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
870 |
recordingStream == &aStream && |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
871 |
aStream.State() == CMceMediaStream::ENoResources && |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
872 |
aSink.IsEnabled() == EFalse ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
873 |
{ |
33 | 874 |
iLiveSessionObserver.DiskFull(); |
0
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
875 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
876 |
else |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
877 |
{ |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
878 |
// Cannot handle, forward to a base class |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
879 |
CMusEngMceSession::StreamStateChanged( aStream, aSink ); |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
880 |
} |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
881 |
|
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
882 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::StreamStateChanged( sink )" ) |
f0cf47e981f9
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
883 |
} |
33 | 884 |
|
885 |
||
886 |
// ----------------------------------------------------------------------------- |
|
887 |
// |
|
888 |
// ----------------------------------------------------------------------------- |
|
889 |
// |
|
890 |
CMusEngLiveSession::CMusEngLiveSession( |
|
891 |
MMusEngSessionObserver& aSessionObserver, |
|
892 |
MMusEngOutSessionObserver& aOutSessionObserver, |
|
893 |
MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
894 |
const TRect& aRect, |
|
895 |
const TDesC& aRecordedFile ) |
|
896 |
: CMusEngMceOutSession( aRect, |
|
897 |
aSessionObserver, |
|
898 |
aOutSessionObserver ), |
|
899 |
iLiveSessionObserver( aLiveSessionObserver ), |
|
900 |
iDefaultZoomFactor( -1 ), |
|
901 |
iDefaultBrightness( 0 ), |
|
902 |
iRecordedFile( aRecordedFile ), |
|
903 |
iZoomInTime(0), |
|
904 |
iZoomOutTime(0), |
|
905 |
iSmallZoomStep( KZoomStepMinSize ), |
|
906 |
iBigZoomStep( KZoomStepMinSize ) |
|
907 |
{ |
|
908 |
} |
|
909 |
||
910 |
||
911 |
// ----------------------------------------------------------------------------- |
|
912 |
// |
|
913 |
// ----------------------------------------------------------------------------- |
|
914 |
// |
|
915 |
void CMusEngLiveSession::ConstructL( TUint aSipProfileId ) |
|
916 |
{ |
|
917 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConstructL()" ) |
|
918 |
||
919 |
CMusEngMceOutSession::ConstructL( aSipProfileId ); |
|
920 |
||
921 |
iOrientationHandler = CMusEngOrientationHandler::NewL( *this, iLiveSessionObserver ); |
|
922 |
||
923 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConstructL()" ) |
|
924 |
} |
|
925 |
||
926 |
||
927 |
// ----------------------------------------------------------------------------- |
|
928 |
// |
|
929 |
// ----------------------------------------------------------------------------- |
|
930 |
// |
|
931 |
void CMusEngLiveSession::SetEncodingDeviceL( CMceVideoCodec& aVideoCodec ) |
|
932 |
{ |
|
933 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::SetEncodingDeviceL()" ) |
|
934 |
||
935 |
// We try to read encoding device UID. If we do not succeed, we use default |
|
936 |
||
937 |
const TUid KDefaultEncodingDevice( TUid::Uid( 0x20001C13 ) ); |
|
938 |
TUid encodingDevice( KDefaultEncodingDevice ); |
|
939 |
TRAPD( error, |
|
940 |
encodingDevice = MultimediaSharingSettings::EncodingDeviceL() ) |
|
941 |
__ASSERT_ALWAYS( error == KErrNone || error == KErrNotFound, |
|
942 |
User::Leave( error ) ); |
|
943 |
aVideoCodec.SetPreferredEncodingDecodingDeviceL( encodingDevice ); |
|
944 |
||
945 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetEncodingDeviceL()" ) |
|
946 |
} |
|
947 |
||
948 |
||
949 |
// ----------------------------------------------------------------------------- |
|
950 |
// |
|
951 |
// ----------------------------------------------------------------------------- |
|
952 |
// |
|
953 |
void CMusEngLiveSession::SetCodecConfigKeyL( CMceVideoCodec& aVideoCodec ) |
|
954 |
{ |
|
955 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::SetCodecConfigKeyL()" ) |
|
956 |
||
957 |
HBufC8* configKey( NULL ); |
|
958 |
||
959 |
// We try to read config key. If we do not succeed, we prepare to |
|
960 |
// write keys to CenRep for the next time. |
|
961 |
TRAPD( error, configKey = ReadCodecConfigKeyL( aVideoCodec ) ) |
|
962 |
||
963 |
if ( error == KErrNone ) |
|
964 |
{ |
|
965 |
// There is a repository for config keys |
|
966 |
if ( configKey ) |
|
967 |
{ |
|
968 |
// ...and key is found. |
|
969 |
CleanupStack::PushL( configKey ); |
|
970 |
aVideoCodec.SetConfigKeyL( *configKey ); |
|
971 |
CleanupStack::PopAndDestroy( configKey ); |
|
972 |
} |
|
973 |
else |
|
974 |
{ |
|
975 |
// ...but key is not found, so it must be written to CenRep when |
|
976 |
// available. |
|
977 |
iStoreEncoderConfigInfo = ETrue; |
|
978 |
} |
|
979 |
} |
|
980 |
else if ( error == KErrNotFound ) |
|
981 |
{ |
|
982 |
// There is no repository for config keys so there is no point |
|
983 |
// trying to write anything there. Session setup can still continue. |
|
984 |
MUS_LOG1( "mus: [ENGINE] No repository for config keys [%d]", error ) |
|
985 |
} |
|
986 |
else |
|
987 |
{ |
|
988 |
User::Leave( error ); |
|
989 |
} |
|
990 |
||
991 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetCodecConfigKeyL()" ) |
|
992 |
} |
|
993 |
||
994 |
||
995 |
// ----------------------------------------------------------------------------- |
|
996 |
// |
|
997 |
// ----------------------------------------------------------------------------- |
|
998 |
// |
|
999 |
HBufC8* CMusEngLiveSession::ReadCodecConfigKeyL( |
|
1000 |
const CMceVideoCodec& aVideoCodec ) const |
|
1001 |
{ |
|
1002 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ReadCodecConfigKeyL()" ) |
|
1003 |
||
1004 |
HBufC8* key( NULL ); |
|
1005 |
||
1006 |
HBufC8* encoderInfo = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1007 |
__ASSERT_ALWAYS( encoderInfo, User::Leave( KErrNotFound ) ); |
|
1008 |
||
1009 |
TPtrC8 keyId( ConfigKeyIdL( aVideoCodec ) ); |
|
1010 |
||
1011 |
TInt tokenStartPosition( encoderInfo->FindC( keyId ) ); |
|
1012 |
if ( tokenStartPosition > KErrNotFound ) |
|
1013 |
{ |
|
1014 |
TInt tokenLength( encoderInfo->Mid( tokenStartPosition ).FindC( |
|
1015 |
KMusEncoderInfoTokenizer ) ); |
|
1016 |
if ( tokenLength > KErrNotFound ) |
|
1017 |
{ |
|
1018 |
// Separate key from token by removing keyId |
|
1019 |
TInt keyStartPosition = tokenStartPosition + keyId.Length(); |
|
1020 |
TInt keyLength = tokenLength - keyId.Length(); |
|
1021 |
TPtrC8 keyPtr = encoderInfo->Mid( keyStartPosition, keyLength ); |
|
1022 |
key = keyPtr.AllocL(); |
|
1023 |
} |
|
1024 |
} |
|
1025 |
||
1026 |
CleanupStack::PopAndDestroy( encoderInfo ); |
|
1027 |
||
1028 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ReadCodecConfigKeyL()" ) |
|
1029 |
||
1030 |
return key; |
|
1031 |
} |
|
1032 |
||
1033 |
||
1034 |
// ----------------------------------------------------------------------------- |
|
1035 |
// |
|
1036 |
// ----------------------------------------------------------------------------- |
|
1037 |
// |
|
1038 |
void CMusEngLiveSession::StoreEncoderConfigInfoL() const |
|
1039 |
{ |
|
1040 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::StoreEncoderConfigInfoL()" ) |
|
1041 |
||
1042 |
HBufC8* configInfoInCenRep = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1043 |
__ASSERT_ALWAYS( configInfoInCenRep, User::Leave( KErrNotFound ) ); |
|
1044 |
||
1045 |
TBuf8<NCentralRepositoryConstants::KMaxBinaryLength> keys; |
|
1046 |
keys.Append( *configInfoInCenRep ); |
|
1047 |
||
1048 |
CMceVideoStream* stream = MusEngMceUtils::GetVideoOutStreamL( *iSession ); |
|
1049 |
const RPointerArray<CMceVideoCodec>& codecs = stream->Codecs(); |
|
1050 |
||
1051 |
for ( TInt codecIndex = 0; codecIndex < codecs.Count(); ++codecIndex ) |
|
1052 |
{ |
|
1053 |
if ( codecs[codecIndex]->SdpName().FindF( KMceSDPNameH264 ) >= 0 ) |
|
1054 |
{ |
|
1055 |
const TPtrC8 keyId = ConfigKeyIdL( *codecs[codecIndex] ); |
|
1056 |
HBufC8* configKey = codecs[codecIndex]->ConfigKeyL(); |
|
1057 |
CleanupStack::PushL( configKey ); |
|
1058 |
||
1059 |
if ( configKey && |
|
1060 |
keys.FindF( keyId ) == KErrNotFound && |
|
1061 |
configInfoInCenRep->FindF( keyId ) == KErrNotFound ) |
|
1062 |
{ |
|
1063 |
||
1064 |
if ( keys.Length() + |
|
1065 |
keyId.Length() + |
|
1066 |
configKey->Length() + |
|
1067 |
KMusEncoderInfoTokenizer().Length() < |
|
1068 |
NCentralRepositoryConstants::KMaxBinaryLength ) |
|
1069 |
{ |
|
1070 |
keys.Append( keyId ); |
|
1071 |
keys.Append( *configKey ); |
|
1072 |
keys.Append( KMusEncoderInfoTokenizer ); |
|
1073 |
} |
|
1074 |
} |
|
1075 |
||
1076 |
CleanupStack::PopAndDestroy( configKey ); |
|
1077 |
} |
|
1078 |
} |
|
1079 |
||
1080 |
MultimediaSharingSettings::SetEncoderConfigInfoL( keys ); |
|
1081 |
||
1082 |
CleanupStack::PopAndDestroy( configInfoInCenRep ); |
|
1083 |
||
1084 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::StoreEncoderConfigInfoL()" ) |
|
1085 |
} |
|
1086 |
||
1087 |
||
1088 |
// ----------------------------------------------------------------------------- |
|
1089 |
// |
|
1090 |
// ----------------------------------------------------------------------------- |
|
1091 |
// |
|
1092 |
const TPtrC8 CMusEngLiveSession::ConfigKeyIdL( |
|
1093 |
const CMceVideoCodec& aVideoCodec ) const |
|
1094 |
{ |
|
1095 |
MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConfigKeyIdL()" ) |
|
1096 |
||
1097 |
// Currently works only for AVC |
|
1098 |
__ASSERT_ALWAYS( aVideoCodec.SdpName().FindF( KMceSDPNameH264 ) >= 0, |
|
1099 |
User::Leave( KErrArgument ) ); |
|
1100 |
||
1101 |
TPtrC8 configKeyTokenId; |
|
1102 |
||
1103 |
if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1 ) |
|
1104 |
{ |
|
1105 |
configKeyTokenId.Set( KMusAvcBitrateLevel1() ); |
|
1106 |
} |
|
1107 |
else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1b ) |
|
1108 |
{ |
|
1109 |
configKeyTokenId.Set( KMusAvcBitrateLevel1b() ); |
|
1110 |
} |
|
1111 |
else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_1 ) |
|
1112 |
{ |
|
1113 |
configKeyTokenId.Set( KMusAvcBitrateLevel1_1() ); |
|
1114 |
} |
|
1115 |
else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_2 ) |
|
1116 |
{ |
|
1117 |
configKeyTokenId.Set( KMusAvcBitrateLevel1_2() ); |
|
1118 |
} |
|
1119 |
else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_3 ) |
|
1120 |
{ |
|
1121 |
configKeyTokenId.Set( KMusAvcBitrateLevel1_3() ); |
|
1122 |
} |
|
1123 |
else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel2 ) |
|
1124 |
{ |
|
1125 |
configKeyTokenId.Set( KMusAvcBitrateLevel2() ); |
|
1126 |
} |
|
1127 |
else |
|
1128 |
{ |
|
1129 |
User::Leave( KErrNotFound ); |
|
1130 |
} |
|
1131 |
||
1132 |
MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConfigKeyIdL()" ) |
|
1133 |
||
1134 |
return configKeyTokenId; |
|
1135 |
} |
|
1136 |
||
1137 |
||
1138 |
// ----------------------------------------------------------------------------- |
|
1139 |
// Calculate the zoom step based time escaped |
|
1140 |
// ----------------------------------------------------------------------------- |
|
1141 |
TInt CMusEngLiveSession::ZoomStepSize( TInt64& aTime ) |
|
1142 |
{ |
|
1143 |
// MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomStepSize()" ) |
|
1144 |
TTime now; |
|
1145 |
now.HomeTime(); |
|
1146 |
TInt64 timeNow = now.Int64(); |
|
1147 |
TInt stepSize = ( ( timeNow - aTime ) <= KZoomFasterTime ) ? iBigZoomStep : iSmallZoomStep; |
|
1148 |
||
1149 |
aTime = now.Int64(); |
|
1150 |
||
1151 |
MUS_LOG1( "mus: [ENGINE] stepSize = %d", stepSize ); |
|
1152 |
// MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomStepSize()" ) |
|
1153 |
return stepSize; |
|
1154 |
} |
|
1155 |
||
1156 |