sl@0
|
1 |
// Copyright (c) 2002-2010 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 |
#include "mediaclientvideodisplaybody.h"
|
sl@0
|
17 |
#include "mediaclientvideotrace.h"
|
sl@0
|
18 |
#include "mediaclientpolicyserverclient.h"
|
sl@0
|
19 |
#include <surfaceeventhandler.h>
|
sl@0
|
20 |
#include <mmf/plugin/mmfmediaclientextdisplayinterface.hrh>
|
sl@0
|
21 |
#include <e32cmn.h>
|
sl@0
|
22 |
#include <ecom/ecom.h>
|
sl@0
|
23 |
#include <centralrepository.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
const TUid KCRUidTvoutSettings = {0x1020730B};
|
sl@0
|
26 |
const TUint32 KSettingsTvAspectRatio = 0x00000001;
|
sl@0
|
27 |
|
sl@0
|
28 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
29 |
// make sure that off screen is bottom right and not top left. This makes it more efficient for GCE backend
|
sl@0
|
30 |
// to render
|
sl@0
|
31 |
const TInt KHiddenExtentA = 2000; // rect Ax and Ay co-ordinate used to set extent off screen
|
sl@0
|
32 |
const TInt KHiddenExtentB = 2001; // rect Bx and By co-ordinate used to set extent off screen
|
sl@0
|
33 |
#endif
|
sl@0
|
34 |
|
sl@0
|
35 |
CMediaClientVideoDisplayBody* CMediaClientVideoDisplayBody::NewL(TInt aDisplayId, TBool aExtDisplaySwitchingControl)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL +++");
|
sl@0
|
38 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aDisplayId %d", aDisplayId);
|
sl@0
|
39 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aExtDisplaySwitchingControl %d", aExtDisplaySwitchingControl);
|
sl@0
|
40 |
|
sl@0
|
41 |
CMediaClientVideoDisplayBody* self = new (ELeave) CMediaClientVideoDisplayBody(aDisplayId);
|
sl@0
|
42 |
CleanupStack::PushL(self);
|
sl@0
|
43 |
self->ConstructL(aExtDisplaySwitchingControl);
|
sl@0
|
44 |
CleanupStack::Pop(self);
|
sl@0
|
45 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL ---");
|
sl@0
|
46 |
return self;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
CMediaClientVideoDisplayBody* CMediaClientVideoDisplayBody::NewL(TInt aDisplayId, const TSurfaceId& aSurfaceId,
|
sl@0
|
50 |
const TRect& aCropRect, TVideoAspectRatio aAspectRatio, TBool aExtDisplaySwitchingControl)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL +++");
|
sl@0
|
53 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aDisplayId %d", aDisplayId);
|
sl@0
|
54 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]);
|
sl@0
|
55 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::NewL - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY);
|
sl@0
|
56 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::NewL - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator);
|
sl@0
|
57 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::NewL - aExtDisplaySwitchingControl %d", aExtDisplaySwitchingControl);
|
sl@0
|
58 |
|
sl@0
|
59 |
if(aSurfaceId.IsNull())
|
sl@0
|
60 |
{
|
sl@0
|
61 |
User::Leave(KErrArgument);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
CMediaClientVideoDisplayBody* self = new(ELeave) CMediaClientVideoDisplayBody(aDisplayId, aSurfaceId, aCropRect, aAspectRatio);
|
sl@0
|
64 |
CleanupStack::PushL(self);
|
sl@0
|
65 |
self->ConstructL(aExtDisplaySwitchingControl);
|
sl@0
|
66 |
CleanupStack::Pop();
|
sl@0
|
67 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::NewL ---");
|
sl@0
|
68 |
return self;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
void CMediaClientVideoDisplayBody::ConstructL(TBool aExtDisplaySwitchingControl)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL +++");
|
sl@0
|
74 |
|
sl@0
|
75 |
SetWindowArrayPtr2Client();
|
sl@0
|
76 |
|
sl@0
|
77 |
// External display switching and wserv events are only possible if there is
|
sl@0
|
78 |
// an active scheduler in client thread
|
sl@0
|
79 |
if(CActiveScheduler::Current())
|
sl@0
|
80 |
{
|
sl@0
|
81 |
CreateExtDisplayPluginL();
|
sl@0
|
82 |
iWsEventObserver = CMediaClientWsEventObserver::NewL(*this);
|
sl@0
|
83 |
|
sl@0
|
84 |
iServerClient = CMediaClientPolicyServerClient::NewL();
|
sl@0
|
85 |
if(iServerClient->Connect() != KErrNone)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
delete iServerClient;
|
sl@0
|
88 |
iServerClient = NULL;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
if(IsSurfaceCreated() && iServerClient)
|
sl@0
|
92 |
{
|
sl@0
|
93 |
iServerClient->SetSurface(iSurfaceId);
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
// Try and enable display switching by default. If this leaves then do so quietly.
|
sl@0
|
97 |
// Either the client has no scheduler installed or the device does not support external
|
sl@0
|
98 |
// switching (i.e. no plugin was found)
|
sl@0
|
99 |
TRAPD(err, SetExternalDisplaySwitchingL(aExtDisplaySwitchingControl));
|
sl@0
|
100 |
err = err; // remove compile warning
|
sl@0
|
101 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConstructL SetExternalDisplaySwitchingL returned with %d", err);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
else
|
sl@0
|
104 |
{
|
sl@0
|
105 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL No CActiveScheduler - ext display and focus features disabled ");
|
sl@0
|
106 |
}
|
sl@0
|
107 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL ---");
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody(TInt aDisplayId, const TSurfaceId& aSurfaceId,
|
sl@0
|
111 |
const TRect& aCropRect, TVideoAspectRatio aAspectRatio) :
|
sl@0
|
112 |
iDisplayId(aDisplayId),
|
sl@0
|
113 |
iSurfaceId(aSurfaceId),
|
sl@0
|
114 |
iCropRect(aCropRect),
|
sl@0
|
115 |
iAspectRatio(aAspectRatio)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody +++");
|
sl@0
|
118 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody ---");
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody(TInt aDisplayId) :
|
sl@0
|
122 |
iDisplayId(aDisplayId)
|
sl@0
|
123 |
{
|
sl@0
|
124 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody +++");
|
sl@0
|
125 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CMediaClientVideoDisplayBody ---");
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
CMediaClientVideoDisplayBody::~CMediaClientVideoDisplayBody()
|
sl@0
|
129 |
{
|
sl@0
|
130 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::~CMediaClientVideoDisplayBody +++");
|
sl@0
|
131 |
|
sl@0
|
132 |
// remove for whichever array is current
|
sl@0
|
133 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
134 |
|
sl@0
|
135 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
136 |
if(iSwitchedToExternalDisplay)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
SetWindowArrayPtr2Client();
|
sl@0
|
139 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
140 |
}
|
sl@0
|
141 |
#endif
|
sl@0
|
142 |
|
sl@0
|
143 |
iClientWindows.Close();
|
sl@0
|
144 |
iExtDisplayWindows.Close();
|
sl@0
|
145 |
|
sl@0
|
146 |
delete iExtDisplayHandler;
|
sl@0
|
147 |
RemoveExtDisplayPlugin();
|
sl@0
|
148 |
REComSession::FinalClose();
|
sl@0
|
149 |
|
sl@0
|
150 |
delete iWsEventObserver;
|
sl@0
|
151 |
|
sl@0
|
152 |
delete iServerClient;
|
sl@0
|
153 |
|
sl@0
|
154 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::~CMediaClientVideoDisplayBody ---");
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
void CMediaClientVideoDisplayBody::AddDisplayL(MMMFSurfaceEventHandler& aEventHandler)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayL +++");
|
sl@0
|
160 |
if (iEventHandler)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
User::Leave(KErrInUse);
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
iEventHandler = &aEventHandler;
|
sl@0
|
166 |
|
sl@0
|
167 |
if (IsSurfaceCreated())
|
sl@0
|
168 |
{
|
sl@0
|
169 |
iEventHandler->MmsehSurfaceCreated(iDisplayId, iSurfaceId, iCropRect, iAspectRatio);
|
sl@0
|
170 |
}
|
sl@0
|
171 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayL ---");
|
sl@0
|
172 |
}
|
sl@0
|
173 |
|
sl@0
|
174 |
void CMediaClientVideoDisplayBody::AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent,
|
sl@0
|
175 |
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation,
|
sl@0
|
176 |
TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2)
|
sl@0
|
177 |
{
|
sl@0
|
178 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL +++");
|
sl@0
|
179 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow->WsHandle());
|
sl@0
|
180 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY);
|
sl@0
|
181 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
182 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
|
sl@0
|
183 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::AddDisplayWindowL - aScaleWidth %f, aScaleHeight %f", aScaleWidth, aScaleHeight);
|
sl@0
|
184 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aRotation %d", aRotation);
|
sl@0
|
185 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aAutoScaleType %d", aAutoScaleType);
|
sl@0
|
186 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::AddDisplayWindowL - aHorizPos %d, aVertPos %d", aHorizPos, aVertPos);
|
sl@0
|
187 |
|
sl@0
|
188 |
if (!IsRotationValid(aRotation))
|
sl@0
|
189 |
{
|
sl@0
|
190 |
User::Leave(KErrArgument);
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
if (!IsAutoScaleTypeValid(aAutoScaleType))
|
sl@0
|
194 |
{
|
sl@0
|
195 |
User::Leave(KErrArgument);
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
TInt pos = iClientWindows.Find(aWindow->WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
199 |
|
sl@0
|
200 |
if (pos != KErrNotFound)
|
sl@0
|
201 |
{
|
sl@0
|
202 |
User::Leave(KErrInUse);
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
TWindowData winData(aWindow, aClipRect, aVideoExtent, aScaleWidth, aScaleHeight, aRotation, aAutoScaleType, aHorizPos, aVertPos, aWindow2);
|
sl@0
|
206 |
iClientWindows.AppendL(winData);
|
sl@0
|
207 |
|
sl@0
|
208 |
iCropRegion = aCropRegion;
|
sl@0
|
209 |
|
sl@0
|
210 |
TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
|
sl@0
|
211 |
UpdateFocus();
|
sl@0
|
212 |
|
sl@0
|
213 |
if (IsSurfaceCreated())
|
sl@0
|
214 |
{
|
sl@0
|
215 |
// if first window was just added OR the new window has moved us from out of focus to in focus
|
sl@0
|
216 |
if(((iClientWindows.Count() == 1) || !prevClientWindowIsInFocus) && iClientRequestedExtDisplaySwitching &&
|
sl@0
|
217 |
iClientWindowIsInFocus && iExtDisplayConnected)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
TRAPD(err, CreateExtDisplayHandlerL());
|
sl@0
|
220 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL CreateExtDisplayHandlerL error %d", err);
|
sl@0
|
221 |
if(err == KErrNone)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
224 |
// attach surface to client window and hide
|
sl@0
|
225 |
// ignore error - no handling required
|
sl@0
|
226 |
SetHiddenBackgroundSurfaceOnClientWindow(winData);
|
sl@0
|
227 |
#endif
|
sl@0
|
228 |
// handle external display
|
sl@0
|
229 |
SetWindowArrayPtr2Ext();
|
sl@0
|
230 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
231 |
}
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
if(!iSwitchedToExternalDisplay)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
User::LeaveIfError(SetBackgroundSurface(winData, aCropRegion));
|
sl@0
|
237 |
}
|
sl@0
|
238 |
}
|
sl@0
|
239 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL ---");
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
void CMediaClientVideoDisplayBody::UpdateDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent,
|
sl@0
|
243 |
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation,
|
sl@0
|
244 |
TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDisplayWindowL +++");
|
sl@0
|
247 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aWindow WsHandle 0x%X", aWindow->WsHandle());
|
sl@0
|
248 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY);
|
sl@0
|
249 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
250 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
|
sl@0
|
251 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aScaleWidth %f, aScaleHeight %f", aScaleWidth, aScaleHeight);
|
sl@0
|
252 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aRotation %d", aRotation);
|
sl@0
|
253 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aAutoScaleType %d", aAutoScaleType);
|
sl@0
|
254 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::UpdateDisplayWindowL - aHorizPos %d, aVertPos %d", aHorizPos, aVertPos);
|
sl@0
|
255 |
|
sl@0
|
256 |
if (!IsRotationValid(aRotation))
|
sl@0
|
257 |
{
|
sl@0
|
258 |
User::Leave(KErrArgument);
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
if (!IsAutoScaleTypeValid(aAutoScaleType))
|
sl@0
|
262 |
{
|
sl@0
|
263 |
User::Leave(KErrArgument);
|
sl@0
|
264 |
}
|
sl@0
|
265 |
|
sl@0
|
266 |
TInt pos = iClientWindows.Find(aWindow->WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
267 |
User::LeaveIfError(pos);
|
sl@0
|
268 |
iClientWindows.Remove(pos);
|
sl@0
|
269 |
|
sl@0
|
270 |
TWindowData winData(aWindow, aClipRect, aVideoExtent, aScaleWidth, aScaleHeight, aRotation, aAutoScaleType, aHorizPos, aVertPos, aWindow2);
|
sl@0
|
271 |
iClientWindows.AppendL(winData);
|
sl@0
|
272 |
|
sl@0
|
273 |
TRect prevCropRegion = iCropRegion;
|
sl@0
|
274 |
iCropRegion = aCropRegion;
|
sl@0
|
275 |
|
sl@0
|
276 |
if (IsSurfaceCreated())
|
sl@0
|
277 |
{
|
sl@0
|
278 |
if(ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect))
|
sl@0
|
279 |
{
|
sl@0
|
280 |
// all windows need to be redrawn
|
sl@0
|
281 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
282 |
}
|
sl@0
|
283 |
else
|
sl@0
|
284 |
{
|
sl@0
|
285 |
// only redraw affected window as other window data may have changed
|
sl@0
|
286 |
if(!iSwitchedToExternalDisplay)
|
sl@0
|
287 |
{
|
sl@0
|
288 |
User::LeaveIfError(SetBackgroundSurface(winData, aCropRegion));
|
sl@0
|
289 |
}
|
sl@0
|
290 |
}
|
sl@0
|
291 |
}
|
sl@0
|
292 |
|
sl@0
|
293 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDisplayWindowL ---");
|
sl@0
|
294 |
}
|
sl@0
|
295 |
|
sl@0
|
296 |
void CMediaClientVideoDisplayBody::RemoveDisplay()
|
sl@0
|
297 |
{
|
sl@0
|
298 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplay +++");
|
sl@0
|
299 |
iEventHandler = NULL;
|
sl@0
|
300 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplay ---");
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
TInt CMediaClientVideoDisplayBody::RemoveDisplayWindow(const RWindowBase& aWindow)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow +++");
|
sl@0
|
306 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
307 |
|
sl@0
|
308 |
if (pos >= 0)
|
sl@0
|
309 |
{
|
sl@0
|
310 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
311 |
if(IsSurfaceCreated())
|
sl@0
|
312 |
#else
|
sl@0
|
313 |
if(IsSurfaceCreated() && !iSwitchedToExternalDisplay)
|
sl@0
|
314 |
#endif
|
sl@0
|
315 |
{
|
sl@0
|
316 |
iClientWindows[pos].iWindow->RemoveBackgroundSurface(ETrue);
|
sl@0
|
317 |
// Make sure all window rendering has completed before proceeding
|
sl@0
|
318 |
RWsSession* ws = iClientWindows[pos].iWindow->Session();
|
sl@0
|
319 |
if (ws)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
ws->Finish();
|
sl@0
|
322 |
}
|
sl@0
|
323 |
}
|
sl@0
|
324 |
|
sl@0
|
325 |
iClientWindows.Remove(pos);
|
sl@0
|
326 |
|
sl@0
|
327 |
TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
|
sl@0
|
328 |
UpdateFocus();
|
sl@0
|
329 |
|
sl@0
|
330 |
// if only window was just removed OR removal has moved us from in focus to out of focus
|
sl@0
|
331 |
if((iClientWindows.Count() == 0 || prevClientWindowIsInFocus) && iSwitchedToExternalDisplay &&
|
sl@0
|
332 |
!iClientWindowIsInFocus)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
335 |
SetWindowArrayPtr2Client();
|
sl@0
|
336 |
RemoveExtDisplayHandler();
|
sl@0
|
337 |
RedrawWindows(iCropRegion);
|
sl@0
|
338 |
}
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow ---");
|
sl@0
|
342 |
return pos;
|
sl@0
|
343 |
}
|
sl@0
|
344 |
|
sl@0
|
345 |
|
sl@0
|
346 |
TInt CMediaClientVideoDisplayBody::SurfaceCreated(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, const TRect& aCropRegion)
|
sl@0
|
347 |
{
|
sl@0
|
348 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceCreated +++");
|
sl@0
|
349 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]);
|
sl@0
|
350 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY);
|
sl@0
|
351 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator);
|
sl@0
|
352 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
353 |
|
sl@0
|
354 |
TBool emitEvent = EFalse;
|
sl@0
|
355 |
if((iSurfaceId != aSurfaceId) && (!aSurfaceId.IsNull()))
|
sl@0
|
356 |
{
|
sl@0
|
357 |
emitEvent = ETrue;
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
iSurfaceId = aSurfaceId;
|
sl@0
|
361 |
iCropRect = aCropRect;
|
sl@0
|
362 |
iAspectRatio = aAspectRatio;
|
sl@0
|
363 |
iCropRegion = aCropRegion;
|
sl@0
|
364 |
|
sl@0
|
365 |
if(iServerClient)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
iServerClient->SetSurface(iSurfaceId);
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
if (emitEvent && iEventHandler)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
iEventHandler->MmsehSurfaceCreated(iDisplayId, iSurfaceId, iCropRect, iAspectRatio);
|
sl@0
|
373 |
}
|
sl@0
|
374 |
|
sl@0
|
375 |
TInt err = KErrNone;
|
sl@0
|
376 |
if((iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching && iClientWindowIsInFocus)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
if(iExtDisplayConnected && !iExtDisplayHandler)
|
sl@0
|
379 |
{
|
sl@0
|
380 |
TRAP(err, CreateExtDisplayHandlerL());
|
sl@0
|
381 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceCreated CreateExtDisplayHandlerL error %d", err);
|
sl@0
|
382 |
if(err == KErrNone)
|
sl@0
|
383 |
{
|
sl@0
|
384 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
385 |
SetHiddenBackgroundSurfaceOnAllClientWindows();
|
sl@0
|
386 |
#endif
|
sl@0
|
387 |
SetWindowArrayPtr2Ext();
|
sl@0
|
388 |
}
|
sl@0
|
389 |
}
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
err = RedrawWindows(aCropRegion);
|
sl@0
|
393 |
|
sl@0
|
394 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceCreated --- Return error %d", err);
|
sl@0
|
395 |
return err;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
void CMediaClientVideoDisplayBody::RemoveBackgroundSurface(TBool aTriggerRedraw)
|
sl@0
|
399 |
{
|
sl@0
|
400 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveBackgroundSurface +++");
|
sl@0
|
401 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::RemoveBackgroundSurface - iSurfaceId %08x:%08x:%08x:%08x", iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]);
|
sl@0
|
402 |
|
sl@0
|
403 |
if (IsSurfaceCreated())
|
sl@0
|
404 |
{
|
sl@0
|
405 |
RWsSession* ws = NULL;
|
sl@0
|
406 |
TInt count = iWindowsArrayPtr->Count();
|
sl@0
|
407 |
|
sl@0
|
408 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
(*iWindowsArrayPtr)[i].iWindow->RemoveBackgroundSurface(aTriggerRedraw);
|
sl@0
|
411 |
// Make sure all window rendering has completed before proceeding
|
sl@0
|
412 |
ws = (*iWindowsArrayPtr)[i].iWindow->Session();
|
sl@0
|
413 |
if (ws)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
ws->Finish();
|
sl@0
|
416 |
}
|
sl@0
|
417 |
}
|
sl@0
|
418 |
}
|
sl@0
|
419 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveBackgroundSurface ---");
|
sl@0
|
420 |
}
|
sl@0
|
421 |
|
sl@0
|
422 |
void CMediaClientVideoDisplayBody::RemoveSurface(TBool aControllerEvent)
|
sl@0
|
423 |
{
|
sl@0
|
424 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface +++");
|
sl@0
|
425 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::RemoveSurface - iSurfaceId %08x:%08x:%08x:%08x", iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]);
|
sl@0
|
426 |
|
sl@0
|
427 |
if (IsSurfaceCreated())
|
sl@0
|
428 |
{
|
sl@0
|
429 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
430 |
|
sl@0
|
431 |
if (iEventHandler && aControllerEvent)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
iEventHandler->MmsehRemoveSurface(iSurfaceId);
|
sl@0
|
434 |
}
|
sl@0
|
435 |
|
sl@0
|
436 |
if(iSwitchedToExternalDisplay)
|
sl@0
|
437 |
{
|
sl@0
|
438 |
SetWindowArrayPtr2Client();
|
sl@0
|
439 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
440 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
441 |
#endif
|
sl@0
|
442 |
RemoveExtDisplayHandler();
|
sl@0
|
443 |
}
|
sl@0
|
444 |
iSurfaceId = TSurfaceId::CreateNullId();
|
sl@0
|
445 |
}
|
sl@0
|
446 |
|
sl@0
|
447 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveSurface ---");
|
sl@0
|
448 |
}
|
sl@0
|
449 |
|
sl@0
|
450 |
TInt CMediaClientVideoDisplayBody::SurfaceParametersChanged(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio)
|
sl@0
|
451 |
{
|
sl@0
|
452 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged +++");
|
sl@0
|
453 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aSurfaceId %08x:%08x:%08x:%08x", aSurfaceId.iInternal[3], aSurfaceId.iInternal[2], aSurfaceId.iInternal[1], aSurfaceId.iInternal[0]);
|
sl@0
|
454 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SurfaceCreated - aCropRect %d,%d - %d,%d", aCropRect.iTl.iX, aCropRect.iTl.iY, aCropRect.iBr.iX, aCropRect.iBr.iY);
|
sl@0
|
455 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SurfaceCreated - aAspectRatio %d/%d", aAspectRatio.iNumerator, aAspectRatio.iDenominator);
|
sl@0
|
456 |
|
sl@0
|
457 |
if (!IsSurfaceCreated())
|
sl@0
|
458 |
{
|
sl@0
|
459 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged --- Return error KErrNotSupproted");
|
sl@0
|
460 |
return KErrNotSupported;
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
if (iSurfaceId != aSurfaceId)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged --- Return error KErrInUse");
|
sl@0
|
466 |
return KErrInUse;
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
if (iEventHandler)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
iEventHandler->MmsehSurfaceParametersChanged(iSurfaceId, aCropRect, aAspectRatio);
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
TInt error = KErrNone;
|
sl@0
|
475 |
if (iCropRect != aCropRect || iAspectRatio != aAspectRatio)
|
sl@0
|
476 |
{
|
sl@0
|
477 |
// We only need to redraw if the aspect ratio has changed, or the area of the video to
|
sl@0
|
478 |
// display (i.e the intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
479 |
TBool redraw = EFalse;
|
sl@0
|
480 |
if (iAspectRatio != aAspectRatio || SurfaceCropRectChangeRequiresRedraw(iCropRect, aCropRect, iCropRegion))
|
sl@0
|
481 |
{
|
sl@0
|
482 |
redraw = ETrue;
|
sl@0
|
483 |
}
|
sl@0
|
484 |
|
sl@0
|
485 |
iCropRect = aCropRect;
|
sl@0
|
486 |
iAspectRatio = aAspectRatio;
|
sl@0
|
487 |
|
sl@0
|
488 |
if (redraw)
|
sl@0
|
489 |
{
|
sl@0
|
490 |
error = RedrawWindows(iCropRegion);
|
sl@0
|
491 |
}
|
sl@0
|
492 |
}
|
sl@0
|
493 |
else
|
sl@0
|
494 |
{
|
sl@0
|
495 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceParametersChanged - Surface parameters have not changed");
|
sl@0
|
496 |
}
|
sl@0
|
497 |
|
sl@0
|
498 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceParametersChanged --- Return error %d", error);
|
sl@0
|
499 |
return error;
|
sl@0
|
500 |
}
|
sl@0
|
501 |
|
sl@0
|
502 |
TInt CMediaClientVideoDisplayBody::RedrawWindows(const TRect& aCropRegion)
|
sl@0
|
503 |
{
|
sl@0
|
504 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RedrawWindows +++");
|
sl@0
|
505 |
TInt err = KErrNone;
|
sl@0
|
506 |
|
sl@0
|
507 |
iCropRegion = aCropRegion;
|
sl@0
|
508 |
|
sl@0
|
509 |
if(IsSurfaceCreated())
|
sl@0
|
510 |
{
|
sl@0
|
511 |
TInt count = iWindowsArrayPtr->Count();
|
sl@0
|
512 |
|
sl@0
|
513 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
514 |
{
|
sl@0
|
515 |
err = SetBackgroundSurface((*iWindowsArrayPtr)[i], aCropRegion);
|
sl@0
|
516 |
|
sl@0
|
517 |
if (err != KErrNone)
|
sl@0
|
518 |
{
|
sl@0
|
519 |
break;
|
sl@0
|
520 |
}
|
sl@0
|
521 |
}
|
sl@0
|
522 |
}
|
sl@0
|
523 |
|
sl@0
|
524 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::RedrawWindows --- return with %d", err);
|
sl@0
|
525 |
return err;
|
sl@0
|
526 |
}
|
sl@0
|
527 |
|
sl@0
|
528 |
void CMediaClientVideoDisplayBody::UpdateCropRegionL(const TRect& aCropRegion, TInt aPos, TBool aRedrawIndividualWindow)
|
sl@0
|
529 |
{
|
sl@0
|
530 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateCropRegionL +++");
|
sl@0
|
531 |
|
sl@0
|
532 |
TRect prevCropRegion(iCropRegion);
|
sl@0
|
533 |
iCropRegion = aCropRegion;
|
sl@0
|
534 |
|
sl@0
|
535 |
if (IsSurfaceCreated())
|
sl@0
|
536 |
{
|
sl@0
|
537 |
if(prevCropRegion == aCropRegion)
|
sl@0
|
538 |
{
|
sl@0
|
539 |
if(!iSwitchedToExternalDisplay && aRedrawIndividualWindow)
|
sl@0
|
540 |
{
|
sl@0
|
541 |
User::LeaveIfError(SetBackgroundSurface(iClientWindows[aPos], aCropRegion));
|
sl@0
|
542 |
}
|
sl@0
|
543 |
}
|
sl@0
|
544 |
else
|
sl@0
|
545 |
{
|
sl@0
|
546 |
// We only need to redraw if the area of the video to display (i.e the
|
sl@0
|
547 |
// intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
548 |
if (ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect))
|
sl@0
|
549 |
{
|
sl@0
|
550 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
551 |
}
|
sl@0
|
552 |
}
|
sl@0
|
553 |
}
|
sl@0
|
554 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateCropRegionL ---");
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
void CMediaClientVideoDisplayBody::SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos, const TRect& aCropRegion)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL +++");
|
sl@0
|
560 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetAutoScaleL - aWindow WsHandle 0x%X", aWindow.WsHandle());
|
sl@0
|
561 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetAutoScaleL - aScaleType %d", aScaleType);
|
sl@0
|
562 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetAutoScaleL - aHorizPos %d, aVertPos %d", aHorizPos, aVertPos);
|
sl@0
|
563 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetAutoScaleL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
564 |
|
sl@0
|
565 |
if (!IsAutoScaleTypeValid(aScaleType))
|
sl@0
|
566 |
{
|
sl@0
|
567 |
User::Leave(KErrArgument);
|
sl@0
|
568 |
}
|
sl@0
|
569 |
|
sl@0
|
570 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
571 |
User::LeaveIfError(pos);
|
sl@0
|
572 |
|
sl@0
|
573 |
TBool parameterChanged = EFalse;
|
sl@0
|
574 |
if (aScaleType != iClientWindows[pos].iAutoScaleType || aHorizPos != iClientWindows[pos].iHorizPos || aVertPos != iClientWindows[pos].iVertPos)
|
sl@0
|
575 |
{
|
sl@0
|
576 |
iClientWindows[pos].iAutoScaleType = aScaleType;
|
sl@0
|
577 |
iClientWindows[pos].iHorizPos = aHorizPos;
|
sl@0
|
578 |
iClientWindows[pos].iVertPos = aVertPos;
|
sl@0
|
579 |
parameterChanged = ETrue;
|
sl@0
|
580 |
}
|
sl@0
|
581 |
else
|
sl@0
|
582 |
{
|
sl@0
|
583 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL - Scale parameters have not changed");
|
sl@0
|
584 |
}
|
sl@0
|
585 |
|
sl@0
|
586 |
UpdateCropRegionL(aCropRegion, pos, parameterChanged);
|
sl@0
|
587 |
|
sl@0
|
588 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL ---");
|
sl@0
|
589 |
}
|
sl@0
|
590 |
|
sl@0
|
591 |
|
sl@0
|
592 |
void CMediaClientVideoDisplayBody::SetRotationL(const RWindowBase& aWindow, TVideoRotation aRotation, const TRect& aCropRegion)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL +++");
|
sl@0
|
595 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetRotationL - aWindow WsHandle 0x%X", aWindow.WsHandle());
|
sl@0
|
596 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetRotationL - aRotation %d", aRotation);
|
sl@0
|
597 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetRotationL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
598 |
|
sl@0
|
599 |
if (!IsRotationValid(aRotation))
|
sl@0
|
600 |
{
|
sl@0
|
601 |
User::Leave(KErrArgument);
|
sl@0
|
602 |
}
|
sl@0
|
603 |
|
sl@0
|
604 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
605 |
User::LeaveIfError(pos);
|
sl@0
|
606 |
|
sl@0
|
607 |
TBool parameterChanged = EFalse;
|
sl@0
|
608 |
if (aRotation != iClientWindows[pos].iRotation)
|
sl@0
|
609 |
{
|
sl@0
|
610 |
iClientWindows[pos].iRotation = aRotation;
|
sl@0
|
611 |
parameterChanged = ETrue;
|
sl@0
|
612 |
}
|
sl@0
|
613 |
else
|
sl@0
|
614 |
{
|
sl@0
|
615 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL - Rotation has not changed");
|
sl@0
|
616 |
}
|
sl@0
|
617 |
|
sl@0
|
618 |
UpdateCropRegionL(aCropRegion, pos, parameterChanged);
|
sl@0
|
619 |
|
sl@0
|
620 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL ---");
|
sl@0
|
621 |
}
|
sl@0
|
622 |
|
sl@0
|
623 |
TVideoRotation CMediaClientVideoDisplayBody::RotationL(const RWindowBase& aWindow)
|
sl@0
|
624 |
{
|
sl@0
|
625 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RotationL +++");
|
sl@0
|
626 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
627 |
User::LeaveIfError(pos);
|
sl@0
|
628 |
|
sl@0
|
629 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RotationL ---");
|
sl@0
|
630 |
return iClientWindows[pos].iRotation;
|
sl@0
|
631 |
}
|
sl@0
|
632 |
|
sl@0
|
633 |
void CMediaClientVideoDisplayBody::SetScaleFactorL(const RWindowBase& aWindow, TReal32 aWidthPercentage, TReal32 aHeightPercentage, const TRect& aCropRegion)
|
sl@0
|
634 |
{
|
sl@0
|
635 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL +++");
|
sl@0
|
636 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetScaleFactorL - aWindow WsHandle 0x%X", aWindow.WsHandle());
|
sl@0
|
637 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetScaleFactorL - aWidthPercentage %f, aHeightPercentage %f", aWidthPercentage, aHeightPercentage);
|
sl@0
|
638 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetScaleFactorL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
639 |
|
sl@0
|
640 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
641 |
User::LeaveIfError(pos);
|
sl@0
|
642 |
|
sl@0
|
643 |
if (aWidthPercentage <= 0.0 || aHeightPercentage <= 0.0)
|
sl@0
|
644 |
{
|
sl@0
|
645 |
User::Leave(KErrArgument);
|
sl@0
|
646 |
}
|
sl@0
|
647 |
|
sl@0
|
648 |
TBool parameterChanged = EFalse;
|
sl@0
|
649 |
if (aWidthPercentage != iClientWindows[pos].iScaleWidth ||
|
sl@0
|
650 |
aHeightPercentage != iClientWindows[pos].iScaleHeight ||
|
sl@0
|
651 |
EAutoScaleNone != iClientWindows[pos].iAutoScaleType)
|
sl@0
|
652 |
{
|
sl@0
|
653 |
iClientWindows[pos].iScaleWidth = aWidthPercentage;
|
sl@0
|
654 |
iClientWindows[pos].iScaleHeight = aHeightPercentage;
|
sl@0
|
655 |
iClientWindows[pos].iAutoScaleType = EAutoScaleNone;
|
sl@0
|
656 |
parameterChanged = ETrue;
|
sl@0
|
657 |
}
|
sl@0
|
658 |
else
|
sl@0
|
659 |
{
|
sl@0
|
660 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL - Scale parameters have not changed");
|
sl@0
|
661 |
}
|
sl@0
|
662 |
|
sl@0
|
663 |
UpdateCropRegionL(aCropRegion, pos, parameterChanged);
|
sl@0
|
664 |
|
sl@0
|
665 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL ---");
|
sl@0
|
666 |
}
|
sl@0
|
667 |
|
sl@0
|
668 |
void CMediaClientVideoDisplayBody::GetScaleFactorL(const RWindowBase& aWindow, TReal32& aWidthPercentage, TReal32& aHeightPercentage)
|
sl@0
|
669 |
{
|
sl@0
|
670 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::GetScaleFactorL +++");
|
sl@0
|
671 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
672 |
User::LeaveIfError(pos);
|
sl@0
|
673 |
|
sl@0
|
674 |
aWidthPercentage = iClientWindows[pos].iScaleWidth;
|
sl@0
|
675 |
aHeightPercentage = iClientWindows[pos].iScaleHeight;
|
sl@0
|
676 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::GetScaleFactorL ---");
|
sl@0
|
677 |
}
|
sl@0
|
678 |
|
sl@0
|
679 |
void CMediaClientVideoDisplayBody::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos, const TRect& aCropRegion)
|
sl@0
|
680 |
{
|
sl@0
|
681 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL +++");
|
sl@0
|
682 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetAutoScaleL - aScaleType %d", aScaleType);
|
sl@0
|
683 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetAutoScaleL - aHorizPos %d, aVertPos %d", aHorizPos, aVertPos);
|
sl@0
|
684 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetAutoScaleL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
685 |
|
sl@0
|
686 |
if (!IsAutoScaleTypeValid(aScaleType))
|
sl@0
|
687 |
{
|
sl@0
|
688 |
User::Leave(KErrArgument);
|
sl@0
|
689 |
}
|
sl@0
|
690 |
|
sl@0
|
691 |
TRect prevCropRegion(iCropRegion);
|
sl@0
|
692 |
iCropRegion = aCropRegion;
|
sl@0
|
693 |
|
sl@0
|
694 |
TBool parameterChanged;
|
sl@0
|
695 |
TInt count = iClientWindows.Count();
|
sl@0
|
696 |
|
sl@0
|
697 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
698 |
{
|
sl@0
|
699 |
parameterChanged = EFalse;
|
sl@0
|
700 |
if (aScaleType != iClientWindows[i].iAutoScaleType || aHorizPos != iClientWindows[i].iHorizPos || aVertPos != iClientWindows[i].iVertPos)
|
sl@0
|
701 |
{
|
sl@0
|
702 |
iClientWindows[i].iAutoScaleType = aScaleType;
|
sl@0
|
703 |
iClientWindows[i].iHorizPos = aHorizPos;
|
sl@0
|
704 |
iClientWindows[i].iVertPos = aVertPos;
|
sl@0
|
705 |
parameterChanged = ETrue;
|
sl@0
|
706 |
}
|
sl@0
|
707 |
else
|
sl@0
|
708 |
{
|
sl@0
|
709 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetAutoScaleL - Scale parameters for window pos %d have not changed", i);
|
sl@0
|
710 |
}
|
sl@0
|
711 |
|
sl@0
|
712 |
// We only need to redraw if the scale parameters have changed, or the area of the video
|
sl@0
|
713 |
// to display (i.e the intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
714 |
if (IsSurfaceCreated() && !iSwitchedToExternalDisplay && (parameterChanged || ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect)))
|
sl@0
|
715 |
{
|
sl@0
|
716 |
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
|
sl@0
|
717 |
}
|
sl@0
|
718 |
}
|
sl@0
|
719 |
|
sl@0
|
720 |
// We only need to redraw if the area of the video to display (i.e the
|
sl@0
|
721 |
// intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
722 |
if (IsSurfaceCreated() && iSwitchedToExternalDisplay && ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect))
|
sl@0
|
723 |
{
|
sl@0
|
724 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
725 |
}
|
sl@0
|
726 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetAutoScaleL ---");
|
sl@0
|
727 |
}
|
sl@0
|
728 |
|
sl@0
|
729 |
|
sl@0
|
730 |
void CMediaClientVideoDisplayBody::SetRotationL(TVideoRotation aRotation, const TRect& aCropRegion)
|
sl@0
|
731 |
{
|
sl@0
|
732 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL +++");
|
sl@0
|
733 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetRotationL - aRotation %d", aRotation);
|
sl@0
|
734 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetRotationL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
735 |
|
sl@0
|
736 |
if (!IsRotationValid(aRotation))
|
sl@0
|
737 |
{
|
sl@0
|
738 |
User::Leave(KErrArgument);
|
sl@0
|
739 |
}
|
sl@0
|
740 |
|
sl@0
|
741 |
TRect prevCropRegion(iCropRegion);
|
sl@0
|
742 |
iCropRegion = aCropRegion;
|
sl@0
|
743 |
|
sl@0
|
744 |
TBool parameterChanged;
|
sl@0
|
745 |
TInt count = iClientWindows.Count();
|
sl@0
|
746 |
|
sl@0
|
747 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
748 |
{
|
sl@0
|
749 |
parameterChanged = EFalse;
|
sl@0
|
750 |
if (aRotation != iClientWindows[i].iRotation)
|
sl@0
|
751 |
{
|
sl@0
|
752 |
iClientWindows[i].iRotation = aRotation;
|
sl@0
|
753 |
parameterChanged = ETrue;
|
sl@0
|
754 |
}
|
sl@0
|
755 |
else
|
sl@0
|
756 |
{
|
sl@0
|
757 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetRotationL - Rotation for window pos %d has not changed", i);
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
// We only need to redraw if the scale parameters have changed, or the area of the video
|
sl@0
|
761 |
// to display (i.e the intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
762 |
if (IsSurfaceCreated() && !iSwitchedToExternalDisplay && (parameterChanged || ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect)))
|
sl@0
|
763 |
{
|
sl@0
|
764 |
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
|
sl@0
|
765 |
}
|
sl@0
|
766 |
}
|
sl@0
|
767 |
|
sl@0
|
768 |
// We only need to redraw if the area of the video to display (i.e the
|
sl@0
|
769 |
// intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
770 |
if (IsSurfaceCreated() && iSwitchedToExternalDisplay && ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect))
|
sl@0
|
771 |
{
|
sl@0
|
772 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
773 |
}
|
sl@0
|
774 |
|
sl@0
|
775 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetRotationL ---");
|
sl@0
|
776 |
}
|
sl@0
|
777 |
|
sl@0
|
778 |
void CMediaClientVideoDisplayBody::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, const TRect& aCropRegion)
|
sl@0
|
779 |
{
|
sl@0
|
780 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL +++");
|
sl@0
|
781 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetScaleFactorL - aWidthPercentage %f, aHeightPercentage %f", aWidthPercentage, aHeightPercentage);
|
sl@0
|
782 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetScaleFactorL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
783 |
|
sl@0
|
784 |
if (aWidthPercentage <= 0.0 || aHeightPercentage <= 0.0)
|
sl@0
|
785 |
{
|
sl@0
|
786 |
User::Leave(KErrArgument);
|
sl@0
|
787 |
}
|
sl@0
|
788 |
|
sl@0
|
789 |
TRect prevCropRegion(iCropRegion);
|
sl@0
|
790 |
iCropRegion = aCropRegion;
|
sl@0
|
791 |
|
sl@0
|
792 |
TBool parameterChanged;
|
sl@0
|
793 |
TInt count = iClientWindows.Count();
|
sl@0
|
794 |
|
sl@0
|
795 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
796 |
{
|
sl@0
|
797 |
parameterChanged = EFalse;
|
sl@0
|
798 |
|
sl@0
|
799 |
if (aWidthPercentage != iClientWindows[i].iScaleWidth ||
|
sl@0
|
800 |
aHeightPercentage != iClientWindows[i].iScaleHeight ||
|
sl@0
|
801 |
EAutoScaleNone != iClientWindows[i].iAutoScaleType)
|
sl@0
|
802 |
{
|
sl@0
|
803 |
iClientWindows[i].iScaleWidth = aWidthPercentage;
|
sl@0
|
804 |
iClientWindows[i].iScaleHeight = aHeightPercentage;
|
sl@0
|
805 |
iClientWindows[i].iAutoScaleType = EAutoScaleNone;
|
sl@0
|
806 |
parameterChanged = ETrue;
|
sl@0
|
807 |
}
|
sl@0
|
808 |
else
|
sl@0
|
809 |
{
|
sl@0
|
810 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetScaleFactorL - Scale parameters for window pos %d have not changed", i);
|
sl@0
|
811 |
}
|
sl@0
|
812 |
|
sl@0
|
813 |
// We only need to redraw if the scale parameters have changed, or the area of the video to
|
sl@0
|
814 |
// display (i.e the intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
815 |
if (IsSurfaceCreated() && !iSwitchedToExternalDisplay && (parameterChanged || ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect)))
|
sl@0
|
816 |
{
|
sl@0
|
817 |
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
|
sl@0
|
818 |
}
|
sl@0
|
819 |
}
|
sl@0
|
820 |
|
sl@0
|
821 |
// We only need to redraw if the area of the video to display (i.e the
|
sl@0
|
822 |
// intersection of client crop region and surface crop rectangle) has changed.
|
sl@0
|
823 |
if (IsSurfaceCreated() && iSwitchedToExternalDisplay && ClientCropRegionChangeRequiresRedraw(prevCropRegion, aCropRegion, iCropRect))
|
sl@0
|
824 |
{
|
sl@0
|
825 |
User::LeaveIfError(RedrawWindows(aCropRegion));
|
sl@0
|
826 |
}
|
sl@0
|
827 |
|
sl@0
|
828 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetScaleFactorL ---");
|
sl@0
|
829 |
}
|
sl@0
|
830 |
|
sl@0
|
831 |
void CMediaClientVideoDisplayBody::SetWindowClipRectL(const RWindowBase& aWindow, const TRect& aWindowClipRect, const TRect& aCropRegion)
|
sl@0
|
832 |
{
|
sl@0
|
833 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowClipRectL +++");
|
sl@0
|
834 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetWindowClipRectL - aWindow WsHandle 0x%X", aWindow.WsHandle());
|
sl@0
|
835 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetWindowClipRectL - aWindowClipRect %d,%d - %d,%d", aWindowClipRect.iTl.iX, aWindowClipRect.iTl.iY, aWindowClipRect.iBr.iX, aWindowClipRect.iBr.iY);
|
sl@0
|
836 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetWindowClipRectL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
837 |
|
sl@0
|
838 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
839 |
User::LeaveIfError(pos);
|
sl@0
|
840 |
|
sl@0
|
841 |
TBool parameterChanged = EFalse;
|
sl@0
|
842 |
if (aWindowClipRect != iClientWindows[pos].iClipRect)
|
sl@0
|
843 |
{
|
sl@0
|
844 |
// We only want to redraw if the change in the clipping rectangle would result
|
sl@0
|
845 |
// in a change to the area of the display used for the video.
|
sl@0
|
846 |
// The video is always displayed in the intersection of the clipping rectangle
|
sl@0
|
847 |
// and the video extent, so check if this has changed.
|
sl@0
|
848 |
parameterChanged = IntersectionAreaChanged(iClientWindows[pos].iClipRect, aWindowClipRect, iClientWindows[pos].iVideoExtent);
|
sl@0
|
849 |
|
sl@0
|
850 |
iClientWindows[pos].iClipRect = aWindowClipRect;
|
sl@0
|
851 |
}
|
sl@0
|
852 |
else
|
sl@0
|
853 |
{
|
sl@0
|
854 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowClipRectL - Clip rect parameter has not changed");
|
sl@0
|
855 |
}
|
sl@0
|
856 |
|
sl@0
|
857 |
UpdateCropRegionL(aCropRegion, pos, parameterChanged);
|
sl@0
|
858 |
|
sl@0
|
859 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowClipRectL ---");
|
sl@0
|
860 |
}
|
sl@0
|
861 |
|
sl@0
|
862 |
void CMediaClientVideoDisplayBody::SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent, const TRect& aCropRegion)
|
sl@0
|
863 |
{
|
sl@0
|
864 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetVideoExtentL +++");
|
sl@0
|
865 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetVideoExtentL - aWindow WsHandle 0x%X", aWindow.WsHandle());
|
sl@0
|
866 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetVideoExtentL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
|
sl@0
|
867 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetVideoExtentL - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
868 |
|
sl@0
|
869 |
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
|
sl@0
|
870 |
User::LeaveIfError(pos);
|
sl@0
|
871 |
|
sl@0
|
872 |
TBool parameterChanged = EFalse;
|
sl@0
|
873 |
if (aVideoExtent != iClientWindows[pos].iVideoExtent)
|
sl@0
|
874 |
{
|
sl@0
|
875 |
iClientWindows[pos].iVideoExtent = aVideoExtent;
|
sl@0
|
876 |
parameterChanged = ETrue;
|
sl@0
|
877 |
}
|
sl@0
|
878 |
else
|
sl@0
|
879 |
{
|
sl@0
|
880 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetVideoExtentL - Video extent parameter has not changed");
|
sl@0
|
881 |
}
|
sl@0
|
882 |
|
sl@0
|
883 |
UpdateCropRegionL(aCropRegion, pos, parameterChanged);
|
sl@0
|
884 |
|
sl@0
|
885 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetVideoExtentL ---");
|
sl@0
|
886 |
}
|
sl@0
|
887 |
|
sl@0
|
888 |
TBool CMediaClientVideoDisplayBody::HasWindows() const
|
sl@0
|
889 |
{
|
sl@0
|
890 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::HasWindows +++");
|
sl@0
|
891 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::HasWindows --- return %d", (iClientWindows.Count() > 0));
|
sl@0
|
892 |
return (iClientWindows.Count() > 0);
|
sl@0
|
893 |
}
|
sl@0
|
894 |
|
sl@0
|
895 |
TInt CMediaClientVideoDisplayBody::SetBackgroundSurface(TWindowData& aWindowData,
|
sl@0
|
896 |
const TRect& aCropRegion)
|
sl@0
|
897 |
{
|
sl@0
|
898 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetBackgroundSurface +++");
|
sl@0
|
899 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface - iWindow WsHandle 0x%X", aWindowData.iWindow->WsHandle());
|
sl@0
|
900 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - iWindow abs pos %d,%d - width %d, height %d", aWindowData.iWindow->AbsPosition().iX, aWindowData.iWindow->AbsPosition().iY, aWindowData.iWindow->Size().iWidth, aWindowData.iWindow->Size().iHeight);
|
sl@0
|
901 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - iClipRect %d,%d - %d,%d", aWindowData.iClipRect.iTl.iX, aWindowData.iClipRect.iTl.iY, aWindowData.iClipRect.iBr.iX, aWindowData.iClipRect.iBr.iY);
|
sl@0
|
902 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - iVideoExtent %d,%d - %d,%d", aWindowData.iVideoExtent.iTl.iX, aWindowData.iVideoExtent.iTl.iY, aWindowData.iVideoExtent.iBr.iX, aWindowData.iVideoExtent.iBr.iY);
|
sl@0
|
903 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetBackgroundSurface - iScaleWidth %f, iScaleHeight %f", aWindowData.iScaleWidth, aWindowData.iScaleHeight);
|
sl@0
|
904 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface - iRotation %d", aWindowData.iRotation);
|
sl@0
|
905 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface - iAutoScaleType %d", aWindowData.iAutoScaleType);
|
sl@0
|
906 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetBackgroundSurface - iHorizPos %d, iVertPos %d", aWindowData.iHorizPos, aWindowData.iVertPos);
|
sl@0
|
907 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - aCropRegion %d,%d - %d,%d", aCropRegion.iTl.iX, aCropRegion.iTl.iY, aCropRegion.iBr.iX, aCropRegion.iBr.iY);
|
sl@0
|
908 |
|
sl@0
|
909 |
// required as this private function is called directly from external friend class
|
sl@0
|
910 |
iCropRegion = aCropRegion;
|
sl@0
|
911 |
|
sl@0
|
912 |
// viewport is the viewable area of surface
|
sl@0
|
913 |
TRect viewport(iCropRect);
|
sl@0
|
914 |
if (aCropRegion.Width() > 0 || aCropRegion.Height() > 0)
|
sl@0
|
915 |
{
|
sl@0
|
916 |
viewport.Intersection(aCropRegion);
|
sl@0
|
917 |
}
|
sl@0
|
918 |
|
sl@0
|
919 |
// Viewport is 0 size, don't show any video
|
sl@0
|
920 |
if (viewport.Width() <= 0 || viewport.Height() <= 0)
|
sl@0
|
921 |
{
|
sl@0
|
922 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface --- Returned with error %d", KErrArgument);
|
sl@0
|
923 |
return KErrArgument;
|
sl@0
|
924 |
}
|
sl@0
|
925 |
|
sl@0
|
926 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - viewport1 %d,%d - %d,%d", viewport.iTl.iX, viewport.iTl.iY, viewport.iBr.iX, viewport.iBr.iY);
|
sl@0
|
927 |
|
sl@0
|
928 |
TRect videoExtent(aWindowData.iVideoExtent);
|
sl@0
|
929 |
|
sl@0
|
930 |
TReal32 inputWidth = 0.0f;
|
sl@0
|
931 |
TReal32 inputHeight = 0.0f;
|
sl@0
|
932 |
TReal32 pixelAspectRatio = 0.0f;
|
sl@0
|
933 |
switch (aWindowData.iRotation)
|
sl@0
|
934 |
{
|
sl@0
|
935 |
case EVideoRotationNone:
|
sl@0
|
936 |
case EVideoRotationClockwise180:
|
sl@0
|
937 |
inputWidth = static_cast<TReal32>(viewport.Width());
|
sl@0
|
938 |
inputHeight = static_cast<TReal32>(viewport.Height());
|
sl@0
|
939 |
pixelAspectRatio = static_cast<TReal32>(iAspectRatio.iNumerator) / iAspectRatio.iDenominator;
|
sl@0
|
940 |
break;
|
sl@0
|
941 |
case EVideoRotationClockwise90:
|
sl@0
|
942 |
case EVideoRotationClockwise270:
|
sl@0
|
943 |
inputWidth = static_cast<TReal32>(viewport.Height());
|
sl@0
|
944 |
inputHeight = static_cast<TReal32>(viewport.Width());
|
sl@0
|
945 |
pixelAspectRatio = static_cast<TReal32>(iAspectRatio.iDenominator) / iAspectRatio.iNumerator;
|
sl@0
|
946 |
break;
|
sl@0
|
947 |
default:
|
sl@0
|
948 |
// Should never get to default unless there's been some programming error.
|
sl@0
|
949 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface --- Returned with error %d", KErrArgument);
|
sl@0
|
950 |
return KErrArgument;
|
sl@0
|
951 |
}
|
sl@0
|
952 |
|
sl@0
|
953 |
TReal32 viewportAspect = pixelAspectRatio * inputWidth / inputHeight;
|
sl@0
|
954 |
TReal32 vidextAspect = static_cast<TReal32>(videoExtent.Width()) / static_cast<TReal32>(videoExtent.Height());
|
sl@0
|
955 |
|
sl@0
|
956 |
DEBUG_PRINTF4("CMediaClientVideoDisplayBody::SetBackgroundSurface - inputWidth %f, inputHeight %f, PAR %f", inputWidth, inputHeight, pixelAspectRatio);
|
sl@0
|
957 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetBackgroundSurface - viewportAspect %f, vidextAspect %f", viewportAspect, vidextAspect);
|
sl@0
|
958 |
|
sl@0
|
959 |
// Set the extent to the display area in the window. The final height and with is to
|
sl@0
|
960 |
// be changed by deltaHeight and deltaWidth respectively.
|
sl@0
|
961 |
TRect extent(videoExtent);
|
sl@0
|
962 |
|
sl@0
|
963 |
TInt deltaHeight = 0;
|
sl@0
|
964 |
TInt deltaWidth = 0;
|
sl@0
|
965 |
|
sl@0
|
966 |
if (aWindowData.iAutoScaleType == EAutoScaleBestFit)
|
sl@0
|
967 |
{
|
sl@0
|
968 |
if (viewportAspect > vidextAspect)
|
sl@0
|
969 |
{
|
sl@0
|
970 |
// Shrink height to get the correct aspect ratio
|
sl@0
|
971 |
deltaHeight = (TInt) (extent.Width() / viewportAspect - extent.Height());
|
sl@0
|
972 |
}
|
sl@0
|
973 |
else
|
sl@0
|
974 |
{
|
sl@0
|
975 |
// Shrink width to get the correct aspect ratio
|
sl@0
|
976 |
deltaWidth = (TInt) (extent.Height() * viewportAspect - extent.Width());
|
sl@0
|
977 |
}
|
sl@0
|
978 |
}
|
sl@0
|
979 |
else if (aWindowData.iAutoScaleType == EAutoScaleClip)
|
sl@0
|
980 |
{
|
sl@0
|
981 |
if (viewportAspect > vidextAspect)
|
sl@0
|
982 |
{
|
sl@0
|
983 |
// Expand width to get the correct aspect ratio
|
sl@0
|
984 |
deltaWidth = (TInt) (extent.Height() * viewportAspect - extent.Width());
|
sl@0
|
985 |
}
|
sl@0
|
986 |
else
|
sl@0
|
987 |
{
|
sl@0
|
988 |
// Expand height to get the correct aspect ratio
|
sl@0
|
989 |
deltaHeight = (TInt) (extent.Width() / viewportAspect - extent.Height());
|
sl@0
|
990 |
}
|
sl@0
|
991 |
}
|
sl@0
|
992 |
else if (aWindowData.iAutoScaleType == EAutoScaleStretch)
|
sl@0
|
993 |
{
|
sl@0
|
994 |
if(iSwitchedToExternalDisplay)
|
sl@0
|
995 |
{
|
sl@0
|
996 |
UpdateDeltaForExtDisplay(viewportAspect, videoExtent, deltaHeight, deltaWidth);
|
sl@0
|
997 |
}
|
sl@0
|
998 |
}
|
sl@0
|
999 |
else if (aWindowData.iAutoScaleType == EAutoScaleNone)
|
sl@0
|
1000 |
{
|
sl@0
|
1001 |
// for non-square pixels, reduce one dimension
|
sl@0
|
1002 |
// XXX other option is to enlarge in the other dimension
|
sl@0
|
1003 |
if(pixelAspectRatio > 1)
|
sl@0
|
1004 |
{
|
sl@0
|
1005 |
inputHeight /= pixelAspectRatio;
|
sl@0
|
1006 |
}
|
sl@0
|
1007 |
else if(pixelAspectRatio < 1)
|
sl@0
|
1008 |
{
|
sl@0
|
1009 |
inputWidth *= pixelAspectRatio;
|
sl@0
|
1010 |
}
|
sl@0
|
1011 |
deltaHeight = (TInt) (inputHeight * aWindowData.iScaleHeight * 0.01 - videoExtent.Height());
|
sl@0
|
1012 |
deltaWidth = (TInt) (inputWidth * aWindowData.iScaleWidth * 0.01 - videoExtent.Width());
|
sl@0
|
1013 |
}
|
sl@0
|
1014 |
|
sl@0
|
1015 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetBackgroundSurface - deltaWidth %d, deltaHeight %d", deltaWidth, deltaHeight);
|
sl@0
|
1016 |
|
sl@0
|
1017 |
// Change the width of the extent in the proper directions and propertions.
|
sl@0
|
1018 |
switch (aWindowData.iHorizPos)
|
sl@0
|
1019 |
{
|
sl@0
|
1020 |
case EHorizontalAlignCenter:
|
sl@0
|
1021 |
extent.iTl.iX -= deltaWidth / 2;
|
sl@0
|
1022 |
extent.iBr.iX += deltaWidth / 2;
|
sl@0
|
1023 |
break;
|
sl@0
|
1024 |
case EHorizontalAlignLeft:
|
sl@0
|
1025 |
extent.iBr.iX += deltaWidth;
|
sl@0
|
1026 |
break;
|
sl@0
|
1027 |
case EHorizontalAlignRight:
|
sl@0
|
1028 |
extent.iTl.iX -= deltaWidth;
|
sl@0
|
1029 |
break;
|
sl@0
|
1030 |
default:
|
sl@0
|
1031 |
TInt width = extent.Width() + deltaWidth;
|
sl@0
|
1032 |
extent.iTl.iX += aWindowData.iHorizPos;
|
sl@0
|
1033 |
extent.iBr.iX = extent.iTl.iX + width;
|
sl@0
|
1034 |
break;
|
sl@0
|
1035 |
}
|
sl@0
|
1036 |
|
sl@0
|
1037 |
// Change the height of the extent in the proper directions and propertions.
|
sl@0
|
1038 |
switch (aWindowData.iVertPos)
|
sl@0
|
1039 |
{
|
sl@0
|
1040 |
case EVerticalAlignCenter:
|
sl@0
|
1041 |
extent.iTl.iY -= deltaHeight / 2;
|
sl@0
|
1042 |
extent.iBr.iY += deltaHeight / 2;
|
sl@0
|
1043 |
break;
|
sl@0
|
1044 |
case EVerticalAlignTop:
|
sl@0
|
1045 |
extent.iBr.iY += deltaHeight;
|
sl@0
|
1046 |
break;
|
sl@0
|
1047 |
case EVerticalAlignBottom:
|
sl@0
|
1048 |
extent.iTl.iY -= deltaHeight;
|
sl@0
|
1049 |
break;
|
sl@0
|
1050 |
default:
|
sl@0
|
1051 |
TInt height = extent.Height() + deltaHeight;
|
sl@0
|
1052 |
extent.iTl.iY += aWindowData.iVertPos;
|
sl@0
|
1053 |
extent.iBr.iY = extent.iTl.iY + height;
|
sl@0
|
1054 |
break;
|
sl@0
|
1055 |
}
|
sl@0
|
1056 |
|
sl@0
|
1057 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - extent1 %d,%d - %d,%d", extent.iTl.iX, extent.iTl.iY, extent.iBr.iX, extent.iBr.iY);
|
sl@0
|
1058 |
|
sl@0
|
1059 |
// The video should not be displayed outside the intended video extent or clipping rectangle.
|
sl@0
|
1060 |
// The extent already has the correct size and position for displaying the entire viewport.
|
sl@0
|
1061 |
// The viewport is clipped such that the video is not moved/distorted when we take the extent
|
sl@0
|
1062 |
// to be the intersection of itself and the intended video extent.
|
sl@0
|
1063 |
|
sl@0
|
1064 |
TRect viewableArea(videoExtent);
|
sl@0
|
1065 |
viewableArea.Intersection(aWindowData.iClipRect);
|
sl@0
|
1066 |
|
sl@0
|
1067 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - viewableArea %d,%d - %d,%d", viewableArea.iTl.iX, viewableArea.iTl.iY, viewableArea.iBr.iX, viewableArea.iBr.iY);
|
sl@0
|
1068 |
|
sl@0
|
1069 |
// Number of pixels (in window coordinates) to be clipped on the right, bottom, top and left sides of
|
sl@0
|
1070 |
// the video.
|
sl@0
|
1071 |
TInt dr = Max(0, extent.iBr.iX - viewableArea.iBr.iX);
|
sl@0
|
1072 |
TInt db = Max(0, extent.iBr.iY - viewableArea.iBr.iY);
|
sl@0
|
1073 |
TInt dt = Max(0, viewableArea.iTl.iY - extent.iTl.iY);
|
sl@0
|
1074 |
TInt dl = Max(0, viewableArea.iTl.iX - extent.iTl.iX);
|
sl@0
|
1075 |
|
sl@0
|
1076 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - dr %d, db %d, dt %d, dl %d", dr, db, dt, dl);
|
sl@0
|
1077 |
|
sl@0
|
1078 |
// Calculate the number of pixels in the video per window pixel in both x and y directions.
|
sl@0
|
1079 |
TReal32 wRatio = 0.0f;
|
sl@0
|
1080 |
TReal32 hRatio = 0.0f;
|
sl@0
|
1081 |
|
sl@0
|
1082 |
// Make sure we don't divide by 0
|
sl@0
|
1083 |
if (extent.Width() != 0)
|
sl@0
|
1084 |
{
|
sl@0
|
1085 |
wRatio = inputWidth / static_cast<TReal32>(extent.Width());
|
sl@0
|
1086 |
}
|
sl@0
|
1087 |
|
sl@0
|
1088 |
if (extent.Height() != 0)
|
sl@0
|
1089 |
{
|
sl@0
|
1090 |
hRatio = inputHeight / static_cast<TReal32>(extent.Height());
|
sl@0
|
1091 |
}
|
sl@0
|
1092 |
|
sl@0
|
1093 |
DEBUG_PRINTF3("CMediaClientVideoDisplayBody::SetBackgroundSurface - wRatio %f, hRatio %f", wRatio, hRatio);
|
sl@0
|
1094 |
|
sl@0
|
1095 |
// Clip the viewport
|
sl@0
|
1096 |
switch (aWindowData.iRotation)
|
sl@0
|
1097 |
{
|
sl@0
|
1098 |
case EVideoRotationNone:
|
sl@0
|
1099 |
viewport.iBr.iX -= (TInt) (wRatio * static_cast<TReal32>(dr));
|
sl@0
|
1100 |
viewport.iBr.iY -= (TInt) (hRatio * static_cast<TReal32>(db));
|
sl@0
|
1101 |
viewport.iTl.iX += (TInt) (wRatio * static_cast<TReal32>(dl));
|
sl@0
|
1102 |
viewport.iTl.iY += (TInt) (hRatio * static_cast<TReal32>(dt));
|
sl@0
|
1103 |
break;
|
sl@0
|
1104 |
case EVideoRotationClockwise180:
|
sl@0
|
1105 |
viewport.iBr.iX -= (TInt) (wRatio * static_cast<TReal32>(dl));
|
sl@0
|
1106 |
viewport.iBr.iY -= (TInt) (hRatio * static_cast<TReal32>(dt));
|
sl@0
|
1107 |
viewport.iTl.iX += (TInt) (wRatio * static_cast<TReal32>(dr));
|
sl@0
|
1108 |
viewport.iTl.iY += (TInt) (hRatio * static_cast<TReal32>(db));
|
sl@0
|
1109 |
break;
|
sl@0
|
1110 |
case EVideoRotationClockwise90:
|
sl@0
|
1111 |
viewport.iBr.iX -= (TInt) (wRatio * static_cast<TReal32>(db));
|
sl@0
|
1112 |
viewport.iBr.iY -= (TInt) (hRatio * static_cast<TReal32>(dl));
|
sl@0
|
1113 |
viewport.iTl.iX += (TInt) (wRatio * static_cast<TReal32>(dt));
|
sl@0
|
1114 |
viewport.iTl.iY += (TInt) (hRatio * static_cast<TReal32>(dr));
|
sl@0
|
1115 |
break;
|
sl@0
|
1116 |
case EVideoRotationClockwise270:
|
sl@0
|
1117 |
viewport.iBr.iX -= (TInt) (wRatio * static_cast<TReal32>(dt));
|
sl@0
|
1118 |
viewport.iBr.iY -= (TInt) (hRatio * static_cast<TReal32>(dr));
|
sl@0
|
1119 |
viewport.iTl.iX += (TInt) (wRatio * static_cast<TReal32>(db));
|
sl@0
|
1120 |
viewport.iTl.iY += (TInt) (hRatio * static_cast<TReal32>(dl));
|
sl@0
|
1121 |
break;
|
sl@0
|
1122 |
default:
|
sl@0
|
1123 |
// Should never get to default unless there's been some programming error.
|
sl@0
|
1124 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface --- Returned with error %d", KErrArgument);
|
sl@0
|
1125 |
return KErrArgument;
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
|
sl@0
|
1128 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - viewport2 %d,%d - %d,%d", viewport.iTl.iX, viewport.iTl.iY, viewport.iBr.iX, viewport.iBr.iY);
|
sl@0
|
1129 |
|
sl@0
|
1130 |
// Clip the extent.
|
sl@0
|
1131 |
extent.Intersection(viewableArea);
|
sl@0
|
1132 |
|
sl@0
|
1133 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - extent2 %d,%d - %d,%d", extent.iTl.iX, extent.iTl.iY, extent.iBr.iX, extent.iBr.iY);
|
sl@0
|
1134 |
|
sl@0
|
1135 |
aWindowData.iSurfaceConfig.SetViewport(viewport);
|
sl@0
|
1136 |
aWindowData.iSurfaceConfig.SetExtent(extent);
|
sl@0
|
1137 |
aWindowData.iSurfaceConfig.SetOrientation(ConvertRotation(aWindowData.iRotation));
|
sl@0
|
1138 |
|
sl@0
|
1139 |
aWindowData.iSurfaceConfig.SetSurfaceId(iSurfaceId);
|
sl@0
|
1140 |
|
sl@0
|
1141 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - iSurfaceId %08x:%08x:%08x:%08x",
|
sl@0
|
1142 |
iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]);
|
sl@0
|
1143 |
|
sl@0
|
1144 |
// Get the rectangle that bounds the crop rectangle and the viewport. This should be
|
sl@0
|
1145 |
// the same as the crop rectangle as long as the viewport does not go outside this area.
|
sl@0
|
1146 |
TRect rect(iCropRect);
|
sl@0
|
1147 |
rect.BoundingRect(viewport);
|
sl@0
|
1148 |
TInt err = KErrNone;
|
sl@0
|
1149 |
|
sl@0
|
1150 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetBackgroundSurface - rect %d,%d - %d,%d", rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY);
|
sl@0
|
1151 |
|
sl@0
|
1152 |
// Check if the viewport and extent can be displayed as a background surface. The viewport
|
sl@0
|
1153 |
// is valid if it is within the crop rectangle and is not empty. The extent is valid if
|
sl@0
|
1154 |
// it is not empty.
|
sl@0
|
1155 |
if (rect == iCropRect && !viewport.IsEmpty() && !extent.IsEmpty())
|
sl@0
|
1156 |
{
|
sl@0
|
1157 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetBackgroundSurface - Calling SetBackgroundSurface");
|
sl@0
|
1158 |
err = aWindowData.iWindow->SetBackgroundSurface(aWindowData.iSurfaceConfig, ETrue);
|
sl@0
|
1159 |
}
|
sl@0
|
1160 |
|
sl@0
|
1161 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetBackgroundSurface --- err %d", err);
|
sl@0
|
1162 |
return err;
|
sl@0
|
1163 |
}
|
sl@0
|
1164 |
|
sl@0
|
1165 |
TBool CMediaClientVideoDisplayBody::IsUsed() const
|
sl@0
|
1166 |
{
|
sl@0
|
1167 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::IsUsed +++");
|
sl@0
|
1168 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsUsed --- return %d", (iEventHandler || iClientWindows.Count() > 0));
|
sl@0
|
1169 |
return (iEventHandler || iClientWindows.Count() > 0);
|
sl@0
|
1170 |
}
|
sl@0
|
1171 |
|
sl@0
|
1172 |
|
sl@0
|
1173 |
TBool CMediaClientVideoDisplayBody::IsSurfaceCreated() const
|
sl@0
|
1174 |
{
|
sl@0
|
1175 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::IsSurfaceCreated +++");
|
sl@0
|
1176 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsSurfaceCreated --- return %d", !(iSurfaceId.IsNull()));
|
sl@0
|
1177 |
return !(iSurfaceId.IsNull());
|
sl@0
|
1178 |
}
|
sl@0
|
1179 |
|
sl@0
|
1180 |
TInt CMediaClientVideoDisplayBody::DisplayId() const
|
sl@0
|
1181 |
{
|
sl@0
|
1182 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::DisplayId +++");
|
sl@0
|
1183 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::DisplayId --- return %d", iDisplayId);
|
sl@0
|
1184 |
return iDisplayId;
|
sl@0
|
1185 |
}
|
sl@0
|
1186 |
|
sl@0
|
1187 |
TInt CMediaClientVideoDisplayBody::CompareByDisplay(const TInt* aDisplayId, const CMediaClientVideoDisplayBody& aDisplay)
|
sl@0
|
1188 |
{
|
sl@0
|
1189 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CompareByDisplay +++");
|
sl@0
|
1190 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::CompareByDisplay --- return %d", (*aDisplayId - aDisplay.DisplayId()));
|
sl@0
|
1191 |
return (*aDisplayId - aDisplay.DisplayId());
|
sl@0
|
1192 |
}
|
sl@0
|
1193 |
|
sl@0
|
1194 |
TInt CMediaClientVideoDisplayBody::Compare(const CMediaClientVideoDisplayBody& aLeft, const CMediaClientVideoDisplayBody& aRight)
|
sl@0
|
1195 |
{
|
sl@0
|
1196 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::Compare +++");
|
sl@0
|
1197 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::Compare --- return %d", (aLeft.DisplayId() - aRight.DisplayId()));
|
sl@0
|
1198 |
return (aLeft.DisplayId() - aRight.DisplayId());
|
sl@0
|
1199 |
}
|
sl@0
|
1200 |
|
sl@0
|
1201 |
CFbsBitGc::TGraphicsOrientation CMediaClientVideoDisplayBody::ConvertRotation(TVideoRotation aRotation)
|
sl@0
|
1202 |
{
|
sl@0
|
1203 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConvertRotation +++");
|
sl@0
|
1204 |
|
sl@0
|
1205 |
CFbsBitGc::TGraphicsOrientation orientation;
|
sl@0
|
1206 |
|
sl@0
|
1207 |
switch(aRotation)
|
sl@0
|
1208 |
{
|
sl@0
|
1209 |
case EVideoRotationNone:
|
sl@0
|
1210 |
orientation = CFbsBitGc::EGraphicsOrientationNormal;
|
sl@0
|
1211 |
break;
|
sl@0
|
1212 |
case EVideoRotationClockwise90:
|
sl@0
|
1213 |
orientation = CFbsBitGc::EGraphicsOrientationRotated270;
|
sl@0
|
1214 |
break;
|
sl@0
|
1215 |
case EVideoRotationClockwise180:
|
sl@0
|
1216 |
orientation = CFbsBitGc::EGraphicsOrientationRotated180;
|
sl@0
|
1217 |
break;
|
sl@0
|
1218 |
case EVideoRotationClockwise270:
|
sl@0
|
1219 |
orientation = CFbsBitGc::EGraphicsOrientationRotated90;
|
sl@0
|
1220 |
break;
|
sl@0
|
1221 |
default:
|
sl@0
|
1222 |
// Should never get to default unless there's been some programming error.
|
sl@0
|
1223 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConvertRotation --- Failed due to %d bad aRotation argument", aRotation);
|
sl@0
|
1224 |
__ASSERT_DEBUG(FALSE, User::Invariant());
|
sl@0
|
1225 |
// Use the normal option otherwise
|
sl@0
|
1226 |
orientation = CFbsBitGc::EGraphicsOrientationNormal;
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConvertRotation --- return %d", orientation);
|
sl@0
|
1229 |
return orientation;
|
sl@0
|
1230 |
}
|
sl@0
|
1231 |
|
sl@0
|
1232 |
CMediaClientVideoDisplayBody* CMediaClientVideoDisplayBody::FindDisplayWithWindowL(const RPointerArray<CMediaClientVideoDisplayBody>& aDisplays, const RWindowBase& aWindow)
|
sl@0
|
1233 |
{
|
sl@0
|
1234 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::FindDisplayWithWindowL +++");
|
sl@0
|
1235 |
TInt count = aDisplays.Count();
|
sl@0
|
1236 |
|
sl@0
|
1237 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
1238 |
{
|
sl@0
|
1239 |
CMediaClientVideoDisplayBody* display = aDisplays[i];
|
sl@0
|
1240 |
|
sl@0
|
1241 |
if (display->iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle) != KErrNotFound)
|
sl@0
|
1242 |
{
|
sl@0
|
1243 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::FindDisplayWithWindowL window found at position ", i);
|
sl@0
|
1244 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::FindDisplayWithWindowL ---");
|
sl@0
|
1245 |
return display;
|
sl@0
|
1246 |
}
|
sl@0
|
1247 |
}
|
sl@0
|
1248 |
|
sl@0
|
1249 |
User::Leave(KErrNotFound);
|
sl@0
|
1250 |
return NULL;
|
sl@0
|
1251 |
}
|
sl@0
|
1252 |
|
sl@0
|
1253 |
RArray<CMediaClientVideoDisplayBody::TWindowData>& CMediaClientVideoDisplayBody::Windows()
|
sl@0
|
1254 |
{
|
sl@0
|
1255 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::Windows +++");
|
sl@0
|
1256 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::Windows ---");
|
sl@0
|
1257 |
return iClientWindows;
|
sl@0
|
1258 |
}
|
sl@0
|
1259 |
|
sl@0
|
1260 |
void CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL(TBool aControl)
|
sl@0
|
1261 |
{
|
sl@0
|
1262 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL +++ aControl=%d", aControl);
|
sl@0
|
1263 |
|
sl@0
|
1264 |
// not supported
|
sl@0
|
1265 |
if(!iExtDisplaySwitchingSupported)
|
sl@0
|
1266 |
{
|
sl@0
|
1267 |
User::Leave(KErrNotSupported);
|
sl@0
|
1268 |
}
|
sl@0
|
1269 |
|
sl@0
|
1270 |
// need active scheduler installed
|
sl@0
|
1271 |
if(!CActiveScheduler::Current())
|
sl@0
|
1272 |
{
|
sl@0
|
1273 |
User::Leave(KErrNotReady);
|
sl@0
|
1274 |
}
|
sl@0
|
1275 |
|
sl@0
|
1276 |
if(iClientRequestedExtDisplaySwitching != aControl)
|
sl@0
|
1277 |
{
|
sl@0
|
1278 |
iClientRequestedExtDisplaySwitching = aControl;
|
sl@0
|
1279 |
SwitchSurface();
|
sl@0
|
1280 |
}
|
sl@0
|
1281 |
|
sl@0
|
1282 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---");
|
sl@0
|
1283 |
}
|
sl@0
|
1284 |
|
sl@0
|
1285 |
void CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected(TExtDisplayConnectionProviderConnType aExtDisplayConnType)
|
sl@0
|
1286 |
{
|
sl@0
|
1287 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected +++ aExtDisplayConnType=%d", aExtDisplayConnType);
|
sl@0
|
1288 |
|
sl@0
|
1289 |
if(aExtDisplayConnType != iExtDisplayConnType)
|
sl@0
|
1290 |
{
|
sl@0
|
1291 |
TExtDisplayConnectionProviderConnType prevExtDisplayConnType = iExtDisplayConnType;
|
sl@0
|
1292 |
iExtDisplayConnType = aExtDisplayConnType;
|
sl@0
|
1293 |
|
sl@0
|
1294 |
if(prevExtDisplayConnType == EExtDisplayConnectionProviderConnTypeDisconnected)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
// disconnected -> connected - don't care which type it is
|
sl@0
|
1297 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected disconnected -> connected(type %d)", iExtDisplayConnType);
|
sl@0
|
1298 |
iExtDisplayConnected = ETrue;
|
sl@0
|
1299 |
SwitchSurface();
|
sl@0
|
1300 |
}
|
sl@0
|
1301 |
else if(iExtDisplayConnType == EExtDisplayConnectionProviderConnTypeDisconnected)
|
sl@0
|
1302 |
{
|
sl@0
|
1303 |
// connected -> disconnected - don't care from which type it is
|
sl@0
|
1304 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected connected(type %d) -> disconnected", prevExtDisplayConnType);
|
sl@0
|
1305 |
iExtDisplayConnected = EFalse;
|
sl@0
|
1306 |
SwitchSurface();
|
sl@0
|
1307 |
}
|
sl@0
|
1308 |
else
|
sl@0
|
1309 |
{
|
sl@0
|
1310 |
// If we get this far then the connection type has changed from "AV Out -> HDMI" or "HDMI -> AV Out"
|
sl@0
|
1311 |
// Both are likely. "AV Out -> HDMI" occurs if AV Out cable is connected and HDMI cable is then connected.
|
sl@0
|
1312 |
// "HDMI -> AV Out" occurs if both AV Out and HDMI cables are connected and HDMI cable is then disconnected.
|
sl@0
|
1313 |
// HDMI is preferred over AV Out.
|
sl@0
|
1314 |
|
sl@0
|
1315 |
// update external display window data
|
sl@0
|
1316 |
iExtDisplayHandler->UpdateWindow();
|
sl@0
|
1317 |
TRect externalDisplayRect(TPoint(0, 0), iExtDisplayHandler->DisplaySizeInPixels());
|
sl@0
|
1318 |
(*iWindowsArrayPtr)[0].iClipRect = externalDisplayRect;
|
sl@0
|
1319 |
(*iWindowsArrayPtr)[0].iVideoExtent = externalDisplayRect;
|
sl@0
|
1320 |
TRAPD(err, (*iWindowsArrayPtr)[0].iAutoScaleType = ExtDisplayAutoScaleTypeL());
|
sl@0
|
1321 |
if(err == KErrNone)
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
1324 |
RedrawWindows(iCropRegion);
|
sl@0
|
1325 |
}
|
sl@0
|
1326 |
else
|
sl@0
|
1327 |
{
|
sl@0
|
1328 |
// Not a lot we can do. Just keep as it is but external display output will be incorrect.
|
sl@0
|
1329 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected ExtDisplayAutoScaleTypeL failed %d", err);
|
sl@0
|
1330 |
}
|
sl@0
|
1331 |
}
|
sl@0
|
1332 |
}
|
sl@0
|
1333 |
else
|
sl@0
|
1334 |
{
|
sl@0
|
1335 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected No change to connection type");
|
sl@0
|
1336 |
}
|
sl@0
|
1337 |
|
sl@0
|
1338 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected ---");
|
sl@0
|
1339 |
}
|
sl@0
|
1340 |
|
sl@0
|
1341 |
void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client()
|
sl@0
|
1342 |
{
|
sl@0
|
1343 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client +++");
|
sl@0
|
1344 |
|
sl@0
|
1345 |
iWindowsArrayPtr = &iClientWindows;
|
sl@0
|
1346 |
iSwitchedToExternalDisplay = EFalse;
|
sl@0
|
1347 |
|
sl@0
|
1348 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client ---");
|
sl@0
|
1349 |
}
|
sl@0
|
1350 |
|
sl@0
|
1351 |
void CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext()
|
sl@0
|
1352 |
{
|
sl@0
|
1353 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext +++");
|
sl@0
|
1354 |
|
sl@0
|
1355 |
iWindowsArrayPtr = &iExtDisplayWindows;
|
sl@0
|
1356 |
iSwitchedToExternalDisplay = ETrue;
|
sl@0
|
1357 |
|
sl@0
|
1358 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext ---");
|
sl@0
|
1359 |
}
|
sl@0
|
1360 |
|
sl@0
|
1361 |
void CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL()
|
sl@0
|
1362 |
{
|
sl@0
|
1363 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL +++");
|
sl@0
|
1364 |
|
sl@0
|
1365 |
CMediaClientExtDisplayHandler* extDisplayHandler = CMediaClientExtDisplayHandler::NewL(iExtDisplayConnectionProvider->ExtDisplayId());
|
sl@0
|
1366 |
CleanupStack::PushL(extDisplayHandler);
|
sl@0
|
1367 |
|
sl@0
|
1368 |
TWindowData windowData;
|
sl@0
|
1369 |
windowData.iWindow = extDisplayHandler->Window();
|
sl@0
|
1370 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL - iWindow WsHandle 0x%X", windowData.iWindow->WsHandle());
|
sl@0
|
1371 |
|
sl@0
|
1372 |
TRect externalDisplayRect(TPoint(0, 0), extDisplayHandler->DisplaySizeInPixels());
|
sl@0
|
1373 |
windowData.iClipRect = externalDisplayRect;
|
sl@0
|
1374 |
windowData.iVideoExtent = externalDisplayRect;
|
sl@0
|
1375 |
// windowData.iScaleWidth only required for EAutoScaleNone
|
sl@0
|
1376 |
// windowData.iScaleWidth only required for EAutoScaleNone
|
sl@0
|
1377 |
windowData.iRotation = EVideoRotationNone;
|
sl@0
|
1378 |
windowData.iAutoScaleType = ExtDisplayAutoScaleTypeL();
|
sl@0
|
1379 |
windowData.iHorizPos = EHorizontalAlignCenter;
|
sl@0
|
1380 |
windowData.iVertPos = EVerticalAlignCenter;
|
sl@0
|
1381 |
// windowData.iWindow2 not used
|
sl@0
|
1382 |
|
sl@0
|
1383 |
iExtDisplayWindows.AppendL(windowData);
|
sl@0
|
1384 |
CleanupStack::Pop(extDisplayHandler);
|
sl@0
|
1385 |
iExtDisplayHandler = extDisplayHandler;
|
sl@0
|
1386 |
|
sl@0
|
1387 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CreateExtDisplayHandlerL ---");
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
|
sl@0
|
1390 |
void CMediaClientVideoDisplayBody::RemoveExtDisplayHandler()
|
sl@0
|
1391 |
{
|
sl@0
|
1392 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayHandler +++");
|
sl@0
|
1393 |
|
sl@0
|
1394 |
delete iExtDisplayHandler;
|
sl@0
|
1395 |
iExtDisplayHandler = NULL;
|
sl@0
|
1396 |
iExtDisplayWindows.Reset();
|
sl@0
|
1397 |
|
sl@0
|
1398 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayHandler ---");
|
sl@0
|
1399 |
}
|
sl@0
|
1400 |
|
sl@0
|
1401 |
void CMediaClientVideoDisplayBody::CreateExtDisplayPluginL()
|
sl@0
|
1402 |
{
|
sl@0
|
1403 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CreateExtDisplayPluginL +++");
|
sl@0
|
1404 |
|
sl@0
|
1405 |
iExtDisplayConnectionProvider = CExtDisplayConnectionProviderInterface::NewL();
|
sl@0
|
1406 |
|
sl@0
|
1407 |
if(iExtDisplayConnectionProvider)
|
sl@0
|
1408 |
{
|
sl@0
|
1409 |
iExtDisplaySwitchingSupported = ETrue;
|
sl@0
|
1410 |
iExtDisplayConnectionProvider->SetExtDisplayConnectionProviderCallback(*this);
|
sl@0
|
1411 |
iExtDisplayConnType = iExtDisplayConnectionProvider->ExtDisplayConnType();
|
sl@0
|
1412 |
iExtDisplayConnected = (iExtDisplayConnType != EExtDisplayConnectionProviderConnTypeDisconnected);
|
sl@0
|
1413 |
}
|
sl@0
|
1414 |
|
sl@0
|
1415 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::CreateExtDisplayPluginL ---");
|
sl@0
|
1416 |
}
|
sl@0
|
1417 |
|
sl@0
|
1418 |
void CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin()
|
sl@0
|
1419 |
{
|
sl@0
|
1420 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin +++");
|
sl@0
|
1421 |
|
sl@0
|
1422 |
if(iExtDisplaySwitchingSupported)
|
sl@0
|
1423 |
{
|
sl@0
|
1424 |
delete iExtDisplayConnectionProvider;
|
sl@0
|
1425 |
iExtDisplayConnectionProvider = NULL;
|
sl@0
|
1426 |
iExtDisplaySwitchingSupported = EFalse;
|
sl@0
|
1427 |
iExtDisplayConnected = EFalse;
|
sl@0
|
1428 |
}
|
sl@0
|
1429 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin ---");
|
sl@0
|
1430 |
}
|
sl@0
|
1431 |
|
sl@0
|
1432 |
void CMediaClientVideoDisplayBody::MmcweoFocusWindowGroupChanged()
|
sl@0
|
1433 |
{
|
sl@0
|
1434 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged +++");
|
sl@0
|
1435 |
|
sl@0
|
1436 |
TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
|
sl@0
|
1437 |
UpdateFocus();
|
sl@0
|
1438 |
|
sl@0
|
1439 |
if(prevClientWindowIsInFocus != iClientWindowIsInFocus)
|
sl@0
|
1440 |
{
|
sl@0
|
1441 |
SwitchSurface();
|
sl@0
|
1442 |
}
|
sl@0
|
1443 |
|
sl@0
|
1444 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged ---");
|
sl@0
|
1445 |
}
|
sl@0
|
1446 |
|
sl@0
|
1447 |
TBool CMediaClientVideoDisplayBody::MmcweoIgnoreProcess(TSecureId aId)
|
sl@0
|
1448 |
{
|
sl@0
|
1449 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess +++");
|
sl@0
|
1450 |
|
sl@0
|
1451 |
TBool ignore = ETrue;
|
sl@0
|
1452 |
if (iServerClient)
|
sl@0
|
1453 |
{
|
sl@0
|
1454 |
ignore = iServerClient->IgnoreProcess(aId);
|
sl@0
|
1455 |
}
|
sl@0
|
1456 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess --- return %d", ignore);
|
sl@0
|
1457 |
return ignore;
|
sl@0
|
1458 |
}
|
sl@0
|
1459 |
|
sl@0
|
1460 |
void CMediaClientVideoDisplayBody::UpdateFocus()
|
sl@0
|
1461 |
{
|
sl@0
|
1462 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus +++");
|
sl@0
|
1463 |
|
sl@0
|
1464 |
if(!iWsEventObserver)
|
sl@0
|
1465 |
{
|
sl@0
|
1466 |
iClientWindowIsInFocus = ETrue;
|
sl@0
|
1467 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Event Observer is NULL");
|
sl@0
|
1468 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---");
|
sl@0
|
1469 |
return;
|
sl@0
|
1470 |
}
|
sl@0
|
1471 |
|
sl@0
|
1472 |
TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
|
sl@0
|
1473 |
|
sl@0
|
1474 |
TInt focusGroupId;
|
sl@0
|
1475 |
if(iWsEventObserver->FocusWindowGroupId(focusGroupId) == KErrNone)
|
sl@0
|
1476 |
{
|
sl@0
|
1477 |
iClientWindowIsInFocus = EFalse;
|
sl@0
|
1478 |
TInt count = iClientWindows.Count();
|
sl@0
|
1479 |
for(TInt i = 0; i < count; i++)
|
sl@0
|
1480 |
{
|
sl@0
|
1481 |
if(iClientWindows[i].iWindow->WindowGroupId() == focusGroupId)
|
sl@0
|
1482 |
{
|
sl@0
|
1483 |
iClientWindowIsInFocus = ETrue;
|
sl@0
|
1484 |
break;
|
sl@0
|
1485 |
}
|
sl@0
|
1486 |
}
|
sl@0
|
1487 |
}
|
sl@0
|
1488 |
else
|
sl@0
|
1489 |
{
|
sl@0
|
1490 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Error retrieving focus WgId from observer");
|
sl@0
|
1491 |
iClientWindowIsInFocus = ETrue;
|
sl@0
|
1492 |
}
|
sl@0
|
1493 |
|
sl@0
|
1494 |
if(iServerClient && (prevClientWindowIsInFocus != iClientWindowIsInFocus))
|
sl@0
|
1495 |
{
|
sl@0
|
1496 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged calling server, focus %d", iClientWindowIsInFocus);
|
sl@0
|
1497 |
iServerClient->FocusChanged(iClientWindowIsInFocus);
|
sl@0
|
1498 |
}
|
sl@0
|
1499 |
|
sl@0
|
1500 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateFocus Client window in focus %d", iClientWindowIsInFocus);
|
sl@0
|
1501 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---");
|
sl@0
|
1502 |
}
|
sl@0
|
1503 |
|
sl@0
|
1504 |
void CMediaClientVideoDisplayBody::SwitchSurface()
|
sl@0
|
1505 |
{
|
sl@0
|
1506 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface +++");
|
sl@0
|
1507 |
|
sl@0
|
1508 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface SurfaceCreated %d", IsSurfaceCreated());
|
sl@0
|
1509 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client window count %d", iClientWindows.Count());
|
sl@0
|
1510 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Requested Ext Display Switching %d", iClientRequestedExtDisplaySwitching);
|
sl@0
|
1511 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Window in Focus %d", iClientWindowIsInFocus);
|
sl@0
|
1512 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface External Display Connected %d", iExtDisplayConnected);
|
sl@0
|
1513 |
|
sl@0
|
1514 |
if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching &&
|
sl@0
|
1515 |
iClientWindowIsInFocus && iExtDisplayConnected)
|
sl@0
|
1516 |
{
|
sl@0
|
1517 |
TRAPD(err, CreateExtDisplayHandlerL());
|
sl@0
|
1518 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface CreateExtDisplayHandlerL error %d", err);
|
sl@0
|
1519 |
if(err == KErrNone)
|
sl@0
|
1520 |
{
|
sl@0
|
1521 |
SetWindowArrayPtr2Ext();
|
sl@0
|
1522 |
RedrawWindows(iCropRegion);
|
sl@0
|
1523 |
|
sl@0
|
1524 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
1525 |
// Hide surface so that video is not seen on client window
|
sl@0
|
1526 |
HideAllClientWindows();
|
sl@0
|
1527 |
#else
|
sl@0
|
1528 |
// Surface removed from window
|
sl@0
|
1529 |
SetWindowArrayPtr2Client();
|
sl@0
|
1530 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
1531 |
SetWindowArrayPtr2Ext();
|
sl@0
|
1532 |
#endif
|
sl@0
|
1533 |
}
|
sl@0
|
1534 |
}
|
sl@0
|
1535 |
else if(iSwitchedToExternalDisplay)
|
sl@0
|
1536 |
{
|
sl@0
|
1537 |
// Set background surface for clientwindows before removing from external display window.
|
sl@0
|
1538 |
SetWindowArrayPtr2Client();
|
sl@0
|
1539 |
// RedrawWindows handles both the case where the surface was removed from client window and
|
sl@0
|
1540 |
// also the case where the surface was hidden from client window
|
sl@0
|
1541 |
RedrawWindows(iCropRegion);
|
sl@0
|
1542 |
SetWindowArrayPtr2Ext();
|
sl@0
|
1543 |
RemoveBackgroundSurface(ETrue);
|
sl@0
|
1544 |
RemoveExtDisplayHandler();
|
sl@0
|
1545 |
SetWindowArrayPtr2Client();
|
sl@0
|
1546 |
}
|
sl@0
|
1547 |
|
sl@0
|
1548 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface ---");
|
sl@0
|
1549 |
}
|
sl@0
|
1550 |
|
sl@0
|
1551 |
TBool CMediaClientVideoDisplayBody::IsRotationValid(TVideoRotation aVideoRotation)
|
sl@0
|
1552 |
{
|
sl@0
|
1553 |
if (aVideoRotation == EVideoRotationNone ||
|
sl@0
|
1554 |
aVideoRotation == EVideoRotationClockwise90 ||
|
sl@0
|
1555 |
aVideoRotation == EVideoRotationClockwise180 ||
|
sl@0
|
1556 |
aVideoRotation == EVideoRotationClockwise270)
|
sl@0
|
1557 |
{
|
sl@0
|
1558 |
return ETrue;
|
sl@0
|
1559 |
}
|
sl@0
|
1560 |
|
sl@0
|
1561 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsRotationValid - Rotation %d not valid", aVideoRotation);
|
sl@0
|
1562 |
return EFalse;
|
sl@0
|
1563 |
}
|
sl@0
|
1564 |
|
sl@0
|
1565 |
TBool CMediaClientVideoDisplayBody::IsAutoScaleTypeValid(TAutoScaleType aAutoScaleType)
|
sl@0
|
1566 |
{
|
sl@0
|
1567 |
if (aAutoScaleType == EAutoScaleNone ||
|
sl@0
|
1568 |
aAutoScaleType == EAutoScaleBestFit ||
|
sl@0
|
1569 |
aAutoScaleType == EAutoScaleClip ||
|
sl@0
|
1570 |
aAutoScaleType == EAutoScaleStretch)
|
sl@0
|
1571 |
{
|
sl@0
|
1572 |
return ETrue;
|
sl@0
|
1573 |
}
|
sl@0
|
1574 |
|
sl@0
|
1575 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsAutoScaleTypeValid - Auto scale %d not valid", aAutoScaleType);
|
sl@0
|
1576 |
return EFalse;
|
sl@0
|
1577 |
}
|
sl@0
|
1578 |
|
sl@0
|
1579 |
/**
|
sl@0
|
1580 |
Check whether a change in the surface crop rectangle would mean that the surface viewport calculated in SetBackgroundSurface would change.
|
sl@0
|
1581 |
The surface viewport is the intersection of the surface crop rectangle and the client crop region
|
sl@0
|
1582 |
*/
|
sl@0
|
1583 |
TBool CMediaClientVideoDisplayBody::SurfaceCropRectChangeRequiresRedraw(TRect aOldSurfaceCropRect, TRect aNewSurfaceCropRect, TRect aClientCropRegion)
|
sl@0
|
1584 |
{
|
sl@0
|
1585 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceCropRectChangeRequiresRedraw +++");
|
sl@0
|
1586 |
|
sl@0
|
1587 |
// If aClientCropRegion is empty then it is not currently being used in the SetBackgroundSurface calculations.
|
sl@0
|
1588 |
// This means that only aOldSurfaceCropRect is being used to decide which part of the video is displayed.
|
sl@0
|
1589 |
// By setting aClientCropRect to the same as aOldSurfaceCropRect we ensure that only aOldSurfaceCropRect is
|
sl@0
|
1590 |
// used in the subsequent intersection area checks.
|
sl@0
|
1591 |
if (aClientCropRegion.IsEmpty())
|
sl@0
|
1592 |
{
|
sl@0
|
1593 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SurfaceCropRectChangeRequiresRedraw - Client crop region is empty");
|
sl@0
|
1594 |
aClientCropRegion = aOldSurfaceCropRect;
|
sl@0
|
1595 |
}
|
sl@0
|
1596 |
|
sl@0
|
1597 |
TBool ret = IntersectionAreaChanged(aOldSurfaceCropRect, aNewSurfaceCropRect, aClientCropRegion);
|
sl@0
|
1598 |
|
sl@0
|
1599 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SurfaceCropRectChangeRequiresRedraw --- ret = %d", ret);
|
sl@0
|
1600 |
|
sl@0
|
1601 |
return ret;
|
sl@0
|
1602 |
}
|
sl@0
|
1603 |
|
sl@0
|
1604 |
/**
|
sl@0
|
1605 |
Check whether a change in the client crop region would mean that the surface viewport calculated in SetBackgroundSurface would change.
|
sl@0
|
1606 |
The surface viewport is the intersection of the surface crop rectangle and the client crop region
|
sl@0
|
1607 |
*/
|
sl@0
|
1608 |
TBool CMediaClientVideoDisplayBody::ClientCropRegionChangeRequiresRedraw(TRect aOldClientCropRegion, TRect aNewClientCropRegion, TRect aSurfaceCropRect)
|
sl@0
|
1609 |
{
|
sl@0
|
1610 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ClientCropRegionChangeRequiresRedraw +++");
|
sl@0
|
1611 |
|
sl@0
|
1612 |
// If aOldClientCropRegion is empty then it is not currently being used in the SetBackgroundSurface calculations.
|
sl@0
|
1613 |
// This means that only aSurfaceCropRect is being used to decide which part of the video is displayed. By
|
sl@0
|
1614 |
// setting aOldClientCropRegion to the same as aSurfaceCropRect we ensure that only aSurfaceCropRect is
|
sl@0
|
1615 |
// used in the subsequent intersection area checks.
|
sl@0
|
1616 |
if (aOldClientCropRegion.IsEmpty())
|
sl@0
|
1617 |
{
|
sl@0
|
1618 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ClientCropRegionChangeRequiresRedraw - Old client crop region is empty");
|
sl@0
|
1619 |
aOldClientCropRegion = aSurfaceCropRect;
|
sl@0
|
1620 |
}
|
sl@0
|
1621 |
|
sl@0
|
1622 |
// If aNewClientCropRegion is empty then it will not be used in the SetBackgroundSurface calculations.
|
sl@0
|
1623 |
// This means that only aSurfaceCropRect will impact which part of the video is displayed. By
|
sl@0
|
1624 |
// setting aNewClientCropRegion to the same as aSurfaceCropRect we ensure that only aSurfaceCropRect is
|
sl@0
|
1625 |
// used in the subsequent intersection area checks.
|
sl@0
|
1626 |
if (aNewClientCropRegion.IsEmpty())
|
sl@0
|
1627 |
{
|
sl@0
|
1628 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ClientCropRegionChangeRequiresRedraw - New client crop region is empty");
|
sl@0
|
1629 |
aNewClientCropRegion = aSurfaceCropRect;
|
sl@0
|
1630 |
}
|
sl@0
|
1631 |
|
sl@0
|
1632 |
TBool ret = IntersectionAreaChanged(aOldClientCropRegion, aNewClientCropRegion, aSurfaceCropRect);
|
sl@0
|
1633 |
|
sl@0
|
1634 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ClientCropRegionChangeRequiresRedraw --- ret = %d", ret);
|
sl@0
|
1635 |
|
sl@0
|
1636 |
return ret;
|
sl@0
|
1637 |
}
|
sl@0
|
1638 |
|
sl@0
|
1639 |
/**
|
sl@0
|
1640 |
Check whether the change in size of a rectangle means its intersection with another rectangle has changed.
|
sl@0
|
1641 |
This is used to check whether changes in things like the surface crop rectangle, client crop region, and window clip rectangle, would mean
|
sl@0
|
1642 |
the area of video displayed would change.
|
sl@0
|
1643 |
*/
|
sl@0
|
1644 |
TBool CMediaClientVideoDisplayBody::IntersectionAreaChanged(TRect aOldRect, TRect aNewRect, TRect aOtherRect)
|
sl@0
|
1645 |
{
|
sl@0
|
1646 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::IntersectionAreaChanged - aOldRect %d,%d - %d,%d", aOldRect.iTl.iX, aOldRect.iTl.iY, aOldRect.iBr.iX, aOldRect.iBr.iY);
|
sl@0
|
1647 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::IntersectionAreaChanged - aNewRect %d,%d - %d,%d", aNewRect.iTl.iX, aNewRect.iTl.iY, aNewRect.iBr.iX, aNewRect.iBr.iY);
|
sl@0
|
1648 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::IntersectionAreaChanged - aOtherRect %d,%d - %d,%d", aOtherRect.iTl.iX, aOtherRect.iTl.iY, aOtherRect.iBr.iX, aOtherRect.iBr.iY);
|
sl@0
|
1649 |
|
sl@0
|
1650 |
aOldRect.Intersection(aOtherRect);
|
sl@0
|
1651 |
aNewRect.Intersection(aOtherRect);
|
sl@0
|
1652 |
|
sl@0
|
1653 |
if (aOldRect != aNewRect)
|
sl@0
|
1654 |
{
|
sl@0
|
1655 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged --- Intersection area has changed");
|
sl@0
|
1656 |
return ETrue;
|
sl@0
|
1657 |
}
|
sl@0
|
1658 |
|
sl@0
|
1659 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::IntersectionAreaChanged --- Intersection area has not changed");
|
sl@0
|
1660 |
return EFalse;
|
sl@0
|
1661 |
}
|
sl@0
|
1662 |
|
sl@0
|
1663 |
/**
|
sl@0
|
1664 |
* This function calculates the delta width and delta height for AV out when the TV-Out setting is set to "widescreen".
|
sl@0
|
1665 |
*
|
sl@0
|
1666 |
* AV out has fixed resolution whether TV-Out is set to "normal" or "widescreen". The TV-Out setting indicates
|
sl@0
|
1667 |
* that the video should be scaled so that when displayed on a corresponding TV the aspect looks correct.
|
sl@0
|
1668 |
*
|
sl@0
|
1669 |
* When displaying video on a widescreen TV through AV out, because the resolution is the same the TV stretches
|
sl@0
|
1670 |
* the video horizontally. When displaying on a normal TV no stretching takes place.
|
sl@0
|
1671 |
*
|
sl@0
|
1672 |
* For "normal" TAutoScaleType::EAutoScaleClip is used.
|
sl@0
|
1673 |
*
|
sl@0
|
1674 |
* For "widescreen" this function calculates the width delta and height delta required so that when the video is stretched
|
sl@0
|
1675 |
* the aspect looks correct on a widescreen TV.
|
sl@0
|
1676 |
*
|
sl@0
|
1677 |
* This function must only be called when autoscale is set to TAutoScaleType::EAutoScaleStretch and an external display is
|
sl@0
|
1678 |
* connected.
|
sl@0
|
1679 |
**/
|
sl@0
|
1680 |
void CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay(TReal32 aViewportAspect, const TRect& aVideoExtent, TInt& aDeltaHeight, TInt& aDeltaWidth)
|
sl@0
|
1681 |
{
|
sl@0
|
1682 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay +++");
|
sl@0
|
1683 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aViewportAspect %f", aViewportAspect);
|
sl@0
|
1684 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
|
sl@0
|
1685 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aDeltaHeight %d", aDeltaHeight);
|
sl@0
|
1686 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay aDeltaWidth %d", aDeltaWidth);
|
sl@0
|
1687 |
|
sl@0
|
1688 |
aDeltaWidth = 0;
|
sl@0
|
1689 |
aDeltaHeight = 0;
|
sl@0
|
1690 |
|
sl@0
|
1691 |
TReal32 wideScreenAspect = (TReal32)16 / (TReal32)9;
|
sl@0
|
1692 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay wideScreenAspect %f", wideScreenAspect);
|
sl@0
|
1693 |
|
sl@0
|
1694 |
if(aViewportAspect == wideScreenAspect)
|
sl@0
|
1695 |
{
|
sl@0
|
1696 |
// no need to calculate
|
sl@0
|
1697 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect equals wideScreenAspect");
|
sl@0
|
1698 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - width delta and height delta not changed");
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
else if(aViewportAspect < wideScreenAspect)
|
sl@0
|
1701 |
{
|
sl@0
|
1702 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect is less than wideScreenAspect");
|
sl@0
|
1703 |
|
sl@0
|
1704 |
// calculate video width for viewport that when stretched looks ok on widescreen
|
sl@0
|
1705 |
TReal32 correctedWidth = (TReal32)aVideoExtent.Width() * aViewportAspect / wideScreenAspect;
|
sl@0
|
1706 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay corrected viewport width %f", correctedWidth);
|
sl@0
|
1707 |
|
sl@0
|
1708 |
aDeltaWidth = correctedWidth - aVideoExtent.Width();
|
sl@0
|
1709 |
}
|
sl@0
|
1710 |
else // aViewportAspect > wideScreenAspect
|
sl@0
|
1711 |
{
|
sl@0
|
1712 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay - Viewport Aspect is greater than wideScreenAspect");
|
sl@0
|
1713 |
|
sl@0
|
1714 |
// calculate video height for viewport that when stretched looks ok on widescreen
|
sl@0
|
1715 |
TReal32 correctedHeight = (TReal32)aVideoExtent.Height() * wideScreenAspect / aViewportAspect;
|
sl@0
|
1716 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay corrected viewport height %f", correctedHeight);
|
sl@0
|
1717 |
|
sl@0
|
1718 |
aDeltaHeight = aVideoExtent.Height() - correctedHeight;
|
sl@0
|
1719 |
}
|
sl@0
|
1720 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay --- aDeltaHeight %d", aDeltaHeight);
|
sl@0
|
1721 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay --- aDeltaWidth %d", aDeltaWidth);
|
sl@0
|
1722 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateDeltaForExtDisplay ---");
|
sl@0
|
1723 |
}
|
sl@0
|
1724 |
|
sl@0
|
1725 |
TBool CMediaClientVideoDisplayBody::IsWideScreenL()
|
sl@0
|
1726 |
{
|
sl@0
|
1727 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::IsWideScreenL +++");
|
sl@0
|
1728 |
|
sl@0
|
1729 |
CRepository* repo = CRepository::NewLC(KCRUidTvoutSettings);
|
sl@0
|
1730 |
TInt value;
|
sl@0
|
1731 |
User::LeaveIfError(repo->Get(KSettingsTvAspectRatio, value));
|
sl@0
|
1732 |
|
sl@0
|
1733 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsWideScreenL Tv Apect Ratio set to %d, 0=4x3 1=16x9", value);
|
sl@0
|
1734 |
|
sl@0
|
1735 |
CleanupStack::PopAndDestroy(repo);
|
sl@0
|
1736 |
|
sl@0
|
1737 |
TBool ret = value > 0;
|
sl@0
|
1738 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::IsWideScreenL --- return %d", ret);
|
sl@0
|
1739 |
return ret;
|
sl@0
|
1740 |
}
|
sl@0
|
1741 |
|
sl@0
|
1742 |
TAutoScaleType CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL()
|
sl@0
|
1743 |
{
|
sl@0
|
1744 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL +++");
|
sl@0
|
1745 |
|
sl@0
|
1746 |
// EExtDisplayConnectionProviderConnTypeHdmi - EAutoScaleBestFit
|
sl@0
|
1747 |
// EExtDisplayConnectionProviderConnTypeAnalog / normal - EAutoScaleBestFit
|
sl@0
|
1748 |
// EExtDisplayConnectionProviderConnTypeAnalog / widescreen - EAutoScaleStretch
|
sl@0
|
1749 |
|
sl@0
|
1750 |
TAutoScaleType autoScaleType;
|
sl@0
|
1751 |
if((iExtDisplayConnType == EExtDisplayConnectionProviderConnTypeAnalog) && IsWideScreenL())
|
sl@0
|
1752 |
{
|
sl@0
|
1753 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL External display scale type EAutoScaleStretch");
|
sl@0
|
1754 |
autoScaleType = EAutoScaleStretch;
|
sl@0
|
1755 |
}
|
sl@0
|
1756 |
else
|
sl@0
|
1757 |
{
|
sl@0
|
1758 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL External display scale type EAutoScaleBestFit");
|
sl@0
|
1759 |
autoScaleType = EAutoScaleBestFit;
|
sl@0
|
1760 |
}
|
sl@0
|
1761 |
|
sl@0
|
1762 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ExtDisplayAutoScaleTypeL --- return %d", autoScaleType);
|
sl@0
|
1763 |
return autoScaleType;
|
sl@0
|
1764 |
}
|
sl@0
|
1765 |
|
sl@0
|
1766 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
1767 |
|
sl@0
|
1768 |
void CMediaClientVideoDisplayBody::HideAllClientWindows()
|
sl@0
|
1769 |
{
|
sl@0
|
1770 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideAllClientWindows +++");
|
sl@0
|
1771 |
|
sl@0
|
1772 |
TInt count = iClientWindows.Count();
|
sl@0
|
1773 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
1774 |
{
|
sl@0
|
1775 |
// ignore error - cannot be handled
|
sl@0
|
1776 |
HideWindow(iClientWindows[i].iWindow);
|
sl@0
|
1777 |
}
|
sl@0
|
1778 |
|
sl@0
|
1779 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideAllClientWindows ---");
|
sl@0
|
1780 |
}
|
sl@0
|
1781 |
|
sl@0
|
1782 |
TInt CMediaClientVideoDisplayBody::HideWindow(RWindowBase* aWindow)
|
sl@0
|
1783 |
{
|
sl@0
|
1784 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideWindow +++");
|
sl@0
|
1785 |
|
sl@0
|
1786 |
TSurfaceConfiguration config;
|
sl@0
|
1787 |
TInt err = aWindow->GetBackgroundSurface(config);
|
sl@0
|
1788 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::HideWindow GetBackgroundSurface error %d", err);
|
sl@0
|
1789 |
|
sl@0
|
1790 |
#ifdef _DEBUG
|
sl@0
|
1791 |
TSurfaceId surface;
|
sl@0
|
1792 |
config.GetSurfaceId(surface);
|
sl@0
|
1793 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::HideWindow - Retrieved Surface %08x:%08x:%08x:%08x",
|
sl@0
|
1794 |
surface.iInternal[3], surface.iInternal[2], surface.iInternal[1], surface.iInternal[0]);
|
sl@0
|
1795 |
#endif
|
sl@0
|
1796 |
|
sl@0
|
1797 |
if (err == KErrNone)
|
sl@0
|
1798 |
{
|
sl@0
|
1799 |
config.SetExtent(TRect(KHiddenExtentA, KHiddenExtentA, KHiddenExtentB, KHiddenExtentB));
|
sl@0
|
1800 |
err = aWindow->SetBackgroundSurface(config, ETrue);
|
sl@0
|
1801 |
// Make sure all window rendering has completed before proceeding
|
sl@0
|
1802 |
RWsSession* ws = aWindow->Session();
|
sl@0
|
1803 |
if (ws)
|
sl@0
|
1804 |
{
|
sl@0
|
1805 |
ws->Finish();
|
sl@0
|
1806 |
}
|
sl@0
|
1807 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::HideWindow SetBackgroundSurface error %d", err);
|
sl@0
|
1808 |
}
|
sl@0
|
1809 |
|
sl@0
|
1810 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::HideWindow ---");
|
sl@0
|
1811 |
return err;
|
sl@0
|
1812 |
}
|
sl@0
|
1813 |
|
sl@0
|
1814 |
void CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows()
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows +++");
|
sl@0
|
1817 |
|
sl@0
|
1818 |
TInt count = iClientWindows.Count();
|
sl@0
|
1819 |
for (TInt i = 0; i < count; ++i)
|
sl@0
|
1820 |
{
|
sl@0
|
1821 |
// ignore error - cannot be handled
|
sl@0
|
1822 |
SetHiddenBackgroundSurfaceOnClientWindow(iClientWindows[i]);
|
sl@0
|
1823 |
}
|
sl@0
|
1824 |
|
sl@0
|
1825 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnAllClientWindows ---");
|
sl@0
|
1826 |
}
|
sl@0
|
1827 |
|
sl@0
|
1828 |
|
sl@0
|
1829 |
TInt CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow(TWindowData& aWindowData)
|
sl@0
|
1830 |
{
|
sl@0
|
1831 |
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow +++");
|
sl@0
|
1832 |
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow - iSurfaceId %08x:%08x:%08x:%08x",
|
sl@0
|
1833 |
iSurfaceId.iInternal[3], iSurfaceId.iInternal[2], iSurfaceId.iInternal[1], iSurfaceId.iInternal[0]);
|
sl@0
|
1834 |
|
sl@0
|
1835 |
TSurfaceConfiguration config;
|
sl@0
|
1836 |
config.SetExtent(TRect(KHiddenExtentA, KHiddenExtentA, KHiddenExtentB, KHiddenExtentB));
|
sl@0
|
1837 |
config.SetSurfaceId(iSurfaceId);
|
sl@0
|
1838 |
TInt err = aWindowData.iWindow->SetBackgroundSurface(config, ETrue);
|
sl@0
|
1839 |
|
sl@0
|
1840 |
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetHiddenBackgroundSurfaceOnClientWindow ---, return %d", err);
|
sl@0
|
1841 |
return err;
|
sl@0
|
1842 |
}
|
sl@0
|
1843 |
#endif
|