|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class is a VideoControl. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMAVIDEOCONTROL_H |
|
20 #define CMMAVIDEOCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "cmmacontrol.h" |
|
24 #include "mmmasnapshotreadycallback.h" |
|
25 |
|
26 // mobitv fix |
|
27 #include "CMIDToolkit.h" |
|
28 #include "lcdui.h" |
|
29 // FORWARD DECLARATIONS |
|
30 class MMIDComponent; |
|
31 class MMMAEventPoster; |
|
32 class MMMAGuiPlayer; |
|
33 class MMMADisplay; |
|
34 class CMMASnapshot; |
|
35 class CMMAEventSource; |
|
36 class CMMAEvent; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * This class is native side of the VideoControl java object. |
|
41 * |
|
42 * |
|
43 */ |
|
44 class CMMAVideoControl : |
|
45 public CMMAControl, |
|
46 public MMMASnapshotReadyCallback, |
|
47 public MMIDEnvObserver |
|
48 { |
|
49 public: |
|
50 /** |
|
51 * @param aGuiPlayer Player that will be used. |
|
52 */ |
|
53 IMPORT_C CMMAVideoControl(MMMAGuiPlayer* aGuiPlayer); |
|
54 |
|
55 /** |
|
56 * Deletes owned objects and removes global reference to |
|
57 * associated displayable object. |
|
58 */ |
|
59 IMPORT_C ~CMMAVideoControl(); |
|
60 |
|
61 /** |
|
62 * Finishes video control construction. This construction step |
|
63 * must be called from JNI, because JNIEnv is needed to create |
|
64 * callback methods to Java side. |
|
65 * |
|
66 * @param aVideoControl Used video control. |
|
67 * @param aControlObject Corresponding Java object. |
|
68 * @param aJni JNI environment used. |
|
69 * @param aEventPoster Used to post repaint and |
|
70 * snapshot ready events. |
|
71 */ |
|
72 static void ConstructL(CMMAVideoControl* aVideoControl, |
|
73 jobject aControlObject, |
|
74 JNIEnv* aJni, |
|
75 MMMAEventPoster* aEventPoster, |
|
76 CMIDToolkit* aToolkit); // mobitv fix |
|
77 |
|
78 public: // New methods |
|
79 /** |
|
80 * Initializes display. Called when java display mode is initialized. |
|
81 * Created MMMADisplay object and sets it to associated gui player. |
|
82 * |
|
83 * @param aVideoControl Used video control. |
|
84 * @param aComponent Component that will be used to create display. |
|
85 * @param aDisplayHandle Java handle to created display will be set to |
|
86 * this variable. Still owned by video control. |
|
87 * @param aDeleteRefEvent Event posted in the destructor. |
|
88 */ |
|
89 static void StaticInitL(CMMAVideoControl* aVideoControl, |
|
90 MMIDComponent* aComponent, |
|
91 TInt* aDisplayHandle, |
|
92 CMMAEvent* aDeleteRefEvent); |
|
93 |
|
94 /** |
|
95 * Dynamic display mode initialization. |
|
96 * @see StaticInitL |
|
97 * @param aVideoControl Used video control. |
|
98 * @param aContentHandle Will contain handle to MMMADirectContent |
|
99 * @param aDeleteRefEvent Event posted in the destructor. |
|
100 */ |
|
101 static void StaticInitDynamicModeL(CMMAVideoControl* aVideoControl, |
|
102 TInt* aContentHandle, |
|
103 CMMAEventSource* aEventSource, |
|
104 jobject aGUIObject, |
|
105 CMMAEvent* aDeleteRefEvent); |
|
106 |
|
107 |
|
108 /** |
|
109 * Gets property according to property type. |
|
110 * |
|
111 * @param aControl Used video control. |
|
112 * @param aPropertyType Type defined in Java header. |
|
113 * @param aReturnValue Property value will be set to this parameter. |
|
114 */ |
|
115 static void StaticGetPropertyL(CMMAVideoControl* aControl, |
|
116 TInt aPropertyType, |
|
117 TInt* aReturnValue); |
|
118 |
|
119 /** |
|
120 * Sets property that is defined by type. Amount of propery |
|
121 * parameters used depends on property type. |
|
122 * |
|
123 * @param aControl Used video control. |
|
124 * @param aPropertyType Type defined in Java header. |
|
125 * @param aPropertyA First value. |
|
126 * @param aPropertyB Second value. |
|
127 */ |
|
128 static void StaticSetPropertyL(CMMAVideoControl* aControl, |
|
129 TInt aPropertyType, |
|
130 TInt aPropertyA, |
|
131 TInt aPropertyB); |
|
132 |
|
133 /** |
|
134 * Takes snapshot from the associated gui player. When ready |
|
135 * Java side will be informed with iSnapshotReadyMethod. |
|
136 * |
|
137 * @param aControl Used video control. |
|
138 * @param aProperties Properties used to create snapshot. |
|
139 */ |
|
140 static void TakeSnapShotL(CMMAVideoControl* aControl, |
|
141 const TDesC* aProperties); |
|
142 static void StaticSetForegroundL(CMMAVideoControl* aControl, |
|
143 TInt aForeground) ; |
|
144 |
|
145 public: // From MMMASnapshotReadyCallback |
|
146 IMPORT_C void SnapshotReady(); |
|
147 |
|
148 public: // From CMMAControl |
|
149 IMPORT_C const TDesC& ClassName() const; |
|
150 public: |
|
151 TBool IsForeground(); |
|
152 |
|
153 protected: |
|
154 void RegisterForegroundListenerL(CMIDToolkit* aToolkit); // mobitv fix |
|
155 |
|
156 public: // from MMIDEnvObserver |
|
157 |
|
158 IMPORT_C void HandleSwitchOnL(TBool /*aSwitchOn*/); |
|
159 |
|
160 //Handles the case when the MIDlet is brought to the foreground. |
|
161 IMPORT_C void HandleForegroundL(TBool /*aForeground*/); |
|
162 |
|
163 // Handles a change to resources which are shared accross the environment. |
|
164 IMPORT_C void HandleResourceChangeL(TInt /*aType*/); |
|
165 |
|
166 private: |
|
167 |
|
168 void SetForeground(TBool aForeground, TBool aUseEventServer); |
|
169 |
|
170 protected: |
|
171 /** |
|
172 * Not owned. |
|
173 */ |
|
174 MMMAEventPoster* iEventPoster; |
|
175 |
|
176 /** |
|
177 * Not owned. |
|
178 */ |
|
179 MMMAGuiPlayer* iGuiPlayer; |
|
180 |
|
181 /** |
|
182 * Not owned. |
|
183 */ |
|
184 JNIEnv* iJni; |
|
185 |
|
186 /** |
|
187 * Owned object. Used to control displayable object. |
|
188 */ |
|
189 MMMADisplay* iDisplay; |
|
190 |
|
191 /** |
|
192 * Owned object. Created when snapshot is taken and destroyed |
|
193 * when snapshot is ready. Destroyed also in destuctor if control is |
|
194 * destroyed when taking snapshot. |
|
195 */ |
|
196 CMMASnapshot* iSnapshot; |
|
197 |
|
198 /** |
|
199 * Java video control object. |
|
200 */ |
|
201 jobject iListenerObject; |
|
202 |
|
203 /** |
|
204 * Used inform Java side when snapshot is ready or error occures. |
|
205 */ |
|
206 jmethodID iSnapshotReadyMethod; |
|
207 |
|
208 /** |
|
209 * Owned object. Not created by the class. |
|
210 * Event is used to destroy reference to associated displayable object, |
|
211 * when video control is destroyed. |
|
212 */ |
|
213 CMMAEvent* iDeleteRefEvent; |
|
214 |
|
215 /** |
|
216 * When video display is set to full screen mode, old |
|
217 * video position & size is stored to this member. When |
|
218 * full screen mode is turned off, this member is used to |
|
219 * find out if display size has been changed during full |
|
220 * screen mode. This is needed to generate a SIZE_CHANGED |
|
221 * event. |
|
222 */ |
|
223 TSize iOldDisplaySize; |
|
224 // mobitv fix |
|
225 CMIDToolkit* iToolkit; |
|
226 MMIDEnv* iMidEnv; |
|
227 TBool iIsForeground; |
|
228 |
|
229 }; |
|
230 |
|
231 #endif // CMMAVIDEOCONTROL_H |