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 |
#ifndef MEDIACLIENTVIDEODISPLAYBODY_H
|
sl@0
|
17 |
#define MEDIACLIENTVIDEODISPLAYBODY_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "mediaclientextdisplayhandler.h"
|
sl@0
|
20 |
#include "mediaclientwseventobserver.h"
|
sl@0
|
21 |
#include <graphics/surface.h>
|
sl@0
|
22 |
#include <graphics/surfaceconfiguration.h>
|
sl@0
|
23 |
#include <mmf/common/mmfvideosurfacecustomcommands.h>
|
sl@0
|
24 |
#include <videoplayer.h>
|
sl@0
|
25 |
#include <mmf/plugin/mmfmediaclientextdisplayinterface.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
class MMMFSurfaceEventHandler;
|
sl@0
|
28 |
class CMediaClientPolicyServerClient;
|
sl@0
|
29 |
|
sl@0
|
30 |
/**
|
sl@0
|
31 |
@internalTechnology
|
sl@0
|
32 |
@released
|
sl@0
|
33 |
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
NONSHARABLE_CLASS(CMediaClientVideoDisplayBody) : public CBase, public MExtDisplayConnectionProviderCallback,
|
sl@0
|
36 |
public MMediaClientWsEventObserverCallback
|
sl@0
|
37 |
{
|
sl@0
|
38 |
private:
|
sl@0
|
39 |
NONSHARABLE_CLASS(TWindowData)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
TWindowData() :
|
sl@0
|
43 |
iWindow(NULL)
|
sl@0
|
44 |
{
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
TWindowData(const RWindowBase* aWindow) :
|
sl@0
|
48 |
iWindow(const_cast<RWindowBase*>(aWindow))
|
sl@0
|
49 |
{
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
TWindowData(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aVideoExtent,
|
sl@0
|
53 |
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation, TAutoScaleType aAutoScaleType,
|
sl@0
|
54 |
TInt aHorizPos, TInt aVertPos,RWindow* aWindow2) :
|
sl@0
|
55 |
iWindow(const_cast<RWindowBase*>(aWindow)),
|
sl@0
|
56 |
iClipRect(aClipRect),
|
sl@0
|
57 |
iVideoExtent(aVideoExtent),
|
sl@0
|
58 |
iScaleWidth(aScaleWidth),
|
sl@0
|
59 |
iScaleHeight(aScaleHeight),
|
sl@0
|
60 |
iRotation(aRotation),
|
sl@0
|
61 |
iAutoScaleType(aAutoScaleType),
|
sl@0
|
62 |
iHorizPos(aHorizPos),
|
sl@0
|
63 |
iVertPos(aVertPos),
|
sl@0
|
64 |
iWindow2(aWindow2)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
RWindowBase* iWindow;
|
sl@0
|
69 |
TSurfaceConfiguration iSurfaceConfig;
|
sl@0
|
70 |
TRect iClipRect;
|
sl@0
|
71 |
TRect iVideoExtent;
|
sl@0
|
72 |
|
sl@0
|
73 |
TReal32 iScaleWidth;
|
sl@0
|
74 |
TReal32 iScaleHeight;
|
sl@0
|
75 |
TVideoRotation iRotation;
|
sl@0
|
76 |
|
sl@0
|
77 |
TAutoScaleType iAutoScaleType;
|
sl@0
|
78 |
TInt iHorizPos;
|
sl@0
|
79 |
TInt iVertPos;
|
sl@0
|
80 |
|
sl@0
|
81 |
// iWindow2 is set when using CVideoPlayerUtility2. This is used to avoid
|
sl@0
|
82 |
// casting iWindow from RWindowBase* to RWindow*.
|
sl@0
|
83 |
RWindow* iWindow2;
|
sl@0
|
84 |
|
sl@0
|
85 |
|
sl@0
|
86 |
static TBool CompareByWsHandle(const TInt* aWsHandle, const TWindowData& aWindowData)
|
sl@0
|
87 |
{
|
sl@0
|
88 |
TBool ret = EFalse;
|
sl@0
|
89 |
if (aWsHandle)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
ret = (*aWsHandle == aWindowData.iWindow->WsHandle());
|
sl@0
|
92 |
}
|
sl@0
|
93 |
return ret;
|
sl@0
|
94 |
}
|
sl@0
|
95 |
};
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
|
sl@0
|
98 |
static CMediaClientVideoDisplayBody* NewL(TInt aDisplayId, TBool aExtDisplaySwitchingControl);
|
sl@0
|
99 |
static CMediaClientVideoDisplayBody* NewL(TInt aDisplayId, const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, TBool aExtDisplaySwitchingControl);
|
sl@0
|
100 |
|
sl@0
|
101 |
~CMediaClientVideoDisplayBody();
|
sl@0
|
102 |
|
sl@0
|
103 |
void AddDisplayL(MMMFSurfaceEventHandler& aEventHandler);
|
sl@0
|
104 |
void AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent,
|
sl@0
|
105 |
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation,
|
sl@0
|
106 |
TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2);
|
sl@0
|
107 |
void UpdateDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent,
|
sl@0
|
108 |
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation,
|
sl@0
|
109 |
TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2);
|
sl@0
|
110 |
void RemoveDisplay();
|
sl@0
|
111 |
TInt RemoveDisplayWindow(const RWindowBase& aWindow);
|
sl@0
|
112 |
|
sl@0
|
113 |
TInt SurfaceCreated(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, const TRect& aCropRegion);
|
sl@0
|
114 |
TInt SurfaceParametersChanged(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio);
|
sl@0
|
115 |
void RemoveSurface(TBool aControllerEvent);
|
sl@0
|
116 |
void RemoveBackgroundSurface(TBool aTriggerRedraw);
|
sl@0
|
117 |
TInt RedrawWindows(const TRect& aCropRegion);
|
sl@0
|
118 |
|
sl@0
|
119 |
void SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos, const TRect& aCropRegion);
|
sl@0
|
120 |
void SetRotationL(const RWindowBase& aWindow, TVideoRotation aRotation, const TRect& aCropRegion);
|
sl@0
|
121 |
TVideoRotation RotationL(const RWindowBase& aWindow);
|
sl@0
|
122 |
void SetScaleFactorL(const RWindowBase& aWindow, TReal32 aWidthPercentage, TReal32 aHeightPercentage, const TRect& aCropRegion);
|
sl@0
|
123 |
void GetScaleFactorL(const RWindowBase& aWindow, TReal32& aWidthPercentage, TReal32& aHeightPercentage);
|
sl@0
|
124 |
|
sl@0
|
125 |
void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos, const TRect& aCropRegion);
|
sl@0
|
126 |
void SetRotationL(TVideoRotation aRotation, const TRect& aCropRegion);
|
sl@0
|
127 |
void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, const TRect& aCropRegion);
|
sl@0
|
128 |
void SetWindowClipRectL(const RWindowBase& aWindow, const TRect& aWindowClipRect, const TRect& aCropRegion);
|
sl@0
|
129 |
void SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent, const TRect& aCropRegion);
|
sl@0
|
130 |
|
sl@0
|
131 |
void SetExternalDisplaySwitchingL(TBool aControl);
|
sl@0
|
132 |
|
sl@0
|
133 |
private:
|
sl@0
|
134 |
|
sl@0
|
135 |
CMediaClientVideoDisplayBody(TInt aDisplayId);
|
sl@0
|
136 |
CMediaClientVideoDisplayBody(TInt aDisplayId, const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio);
|
sl@0
|
137 |
|
sl@0
|
138 |
void ConstructL(TBool aExtDisplaySwitchingControl);
|
sl@0
|
139 |
|
sl@0
|
140 |
CFbsBitGc::TGraphicsOrientation ConvertRotation(TVideoRotation aRotation);
|
sl@0
|
141 |
|
sl@0
|
142 |
RArray<CMediaClientVideoDisplayBody::TWindowData>& Windows();
|
sl@0
|
143 |
TInt DisplayId() const;
|
sl@0
|
144 |
TBool IsUsed() const;
|
sl@0
|
145 |
static TInt CompareByDisplay(const TInt* aDisplayId, const CMediaClientVideoDisplayBody& aDisplay);
|
sl@0
|
146 |
static TInt Compare(const CMediaClientVideoDisplayBody& aLeft, const CMediaClientVideoDisplayBody& aRight);
|
sl@0
|
147 |
static CMediaClientVideoDisplayBody* FindDisplayWithWindowL(const RPointerArray<CMediaClientVideoDisplayBody>& aDisplays, const RWindowBase& aWindow);
|
sl@0
|
148 |
TBool IsSurfaceCreated() const;
|
sl@0
|
149 |
TInt SetBackgroundSurface(TWindowData& aWindowData, const TRect& aCropRegion);
|
sl@0
|
150 |
TBool HasWindows() const;
|
sl@0
|
151 |
|
sl@0
|
152 |
void UpdateCropRegionL(const TRect& aCropRegion, TInt aPos, TBool aRedrawIndividualWindow);
|
sl@0
|
153 |
void CreateExtDisplayPluginL();
|
sl@0
|
154 |
void RemoveExtDisplayPlugin();
|
sl@0
|
155 |
void CreateExtDisplayHandlerL();
|
sl@0
|
156 |
void RemoveExtDisplayHandler();
|
sl@0
|
157 |
void SetWindowArrayPtr2Client();
|
sl@0
|
158 |
void SetWindowArrayPtr2Ext();
|
sl@0
|
159 |
void SwitchSurface();
|
sl@0
|
160 |
void UpdateFocus();
|
sl@0
|
161 |
TBool IsRotationValid(TVideoRotation aVideoRotation);
|
sl@0
|
162 |
TBool IsAutoScaleTypeValid(TAutoScaleType aAutoScaleType);
|
sl@0
|
163 |
TBool SurfaceCropRectChangeRequiresRedraw(TRect aOldSurfaceCropRect, TRect aNewSurfaceCropRect, TRect aClientCropRegion);
|
sl@0
|
164 |
TBool ClientCropRegionChangeRequiresRedraw(TRect aOldClientCropRegion, TRect aNewClientCropRegion, TRect aSurfaceCropRect);
|
sl@0
|
165 |
TBool IntersectionAreaChanged(TRect aOldRect, TRect aNewRect, TRect aOtherRect);
|
sl@0
|
166 |
void UpdateDeltaForExtDisplay(TReal32 aViewportAspect, const TRect& aVideoExtent, TInt& aDeltaHeight, TInt& aDeltaWidth);
|
sl@0
|
167 |
TBool IsWideScreenL();
|
sl@0
|
168 |
TAutoScaleType ExtDisplayAutoScaleTypeL();
|
sl@0
|
169 |
|
sl@0
|
170 |
// MExtDisplayConnectionProviderCallback
|
sl@0
|
171 |
void MedcpcExtDisplayNotifyConnected(TExtDisplayConnectionProviderConnType aExtDisplayConnType);
|
sl@0
|
172 |
|
sl@0
|
173 |
// MMediaClientWsEventObserverCallback
|
sl@0
|
174 |
void MmcweoFocusWindowGroupChanged();
|
sl@0
|
175 |
TBool MmcweoIgnoreProcess(TSecureId aId);
|
sl@0
|
176 |
|
sl@0
|
177 |
#ifdef MEDIA_CLIENT_SURFACE_NOT_REMOVED_FROM_CLIENT_WINDOW
|
sl@0
|
178 |
void HideAllClientWindows();
|
sl@0
|
179 |
TInt HideWindow(RWindowBase* aWindow);
|
sl@0
|
180 |
void SetHiddenBackgroundSurfaceOnAllClientWindows();
|
sl@0
|
181 |
TInt SetHiddenBackgroundSurfaceOnClientWindow(TWindowData& aWindowData);
|
sl@0
|
182 |
#endif
|
sl@0
|
183 |
|
sl@0
|
184 |
private:
|
sl@0
|
185 |
|
sl@0
|
186 |
MMMFSurfaceEventHandler* iEventHandler;
|
sl@0
|
187 |
const TInt iDisplayId;
|
sl@0
|
188 |
TSurfaceId iSurfaceId;
|
sl@0
|
189 |
TRect iCropRect;
|
sl@0
|
190 |
TVideoAspectRatio iAspectRatio;
|
sl@0
|
191 |
|
sl@0
|
192 |
RArray<TWindowData> iClientWindows;
|
sl@0
|
193 |
RArray<TWindowData> iExtDisplayWindows;
|
sl@0
|
194 |
RArray<TWindowData>* iWindowsArrayPtr;
|
sl@0
|
195 |
TBool iSwitchedToExternalDisplay;
|
sl@0
|
196 |
|
sl@0
|
197 |
TRect iCropRegion;
|
sl@0
|
198 |
TBool iClientRequestedExtDisplaySwitching;
|
sl@0
|
199 |
CExtDisplayConnectionProviderInterface* iExtDisplayConnectionProvider;
|
sl@0
|
200 |
CMediaClientExtDisplayHandler* iExtDisplayHandler;
|
sl@0
|
201 |
CMediaClientWsEventObserver* iWsEventObserver;
|
sl@0
|
202 |
TBool iClientWindowIsInFocus;
|
sl@0
|
203 |
TBool iExtDisplayConnected;
|
sl@0
|
204 |
TBool iExtDisplaySwitchingSupported;
|
sl@0
|
205 |
TExtDisplayConnectionProviderConnType iExtDisplayConnType;
|
sl@0
|
206 |
|
sl@0
|
207 |
CMediaClientPolicyServerClient* iServerClient;
|
sl@0
|
208 |
|
sl@0
|
209 |
friend class CVideoPlayerUtility::CBody;
|
sl@0
|
210 |
friend class CTestStepUnitMMFVidClient;
|
sl@0
|
211 |
};
|
sl@0
|
212 |
|
sl@0
|
213 |
#endif // MEDIACLIENTVIDEODISPLAYBODY_H
|
sl@0
|
214 |
|