123 |
123 |
124 LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL - "); |
124 LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL - "); |
125 } |
125 } |
126 */ |
126 */ |
127 void CMMAVideoControl::StaticInitL(CMMAVideoControl* aControl, |
127 void CMMAVideoControl::StaticInitL(CMMAVideoControl* aControl, |
128 jobject javaDisplayRef, |
128 jobject javaDisplayRef, |
129 MMAFunctionServer* aEventSource, |
129 MMAFunctionServer* aEventSource, |
130 TInt* aDisplayHandle, |
130 TInt* aDisplayHandle, |
131 CMMAEvent* aDeleteRefEvent) |
131 CMMAEvent* aDeleteRefEvent, |
132 { |
132 TBool aGuiType) |
133 |
133 { |
134 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL +"); |
134 |
135 |
135 LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL +"); |
136 aControl->iDeleteRefEvent = aDeleteRefEvent; |
136 |
137 |
137 if (aGuiType == true) |
138 CMMACanvasDisplay* canvasDisplay = |
138 { |
139 CMMACanvasDisplay::NewLC(aEventSource,javaDisplayRef); |
139 LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - aGuiType is customitem "); |
140 aControl->iDisplay = canvasDisplay; |
140 aControl->iDeleteRefEvent = aDeleteRefEvent; |
141 CleanupStack::Pop(canvasDisplay); |
|
142 *aDisplayHandle = reinterpret_cast<TInt>(canvasDisplay); |
|
143 |
|
144 |
|
145 /* MMIDComponent::TType componentType = aComponent->Type(); |
|
146 switch (componentType) |
|
147 { |
|
148 case MMIDComponent::ECustomItem: |
|
149 { |
|
150 //MMIDCustomItem // end of // 3.x QT based UI |
|
151 // MMIDCustomItem* customItem = |
|
152 // reinterpret_cast< MMIDCustomItem* >(aComponent); |
|
153 |
141 |
154 CMMAItemDisplay* itemDisplay = |
142 CMMAItemDisplay* itemDisplay = |
155 CMMAItemDisplay::NewLC(customItem); |
143 CMMAItemDisplay::NewLC(aEventSource,javaDisplayRef); |
156 |
|
157 aControl->iDisplay = itemDisplay; |
144 aControl->iDisplay = itemDisplay; |
158 CleanupStack::Pop(itemDisplay); |
145 CleanupStack::Pop(itemDisplay); |
159 *aDisplayHandle = JavaMakeHandle(itemDisplay); |
146 *aDisplayHandle = reinterpret_cast<TInt>(itemDisplay); |
160 break; |
147 } |
161 } |
148 else |
162 case MMIDComponent::ECanvas: |
149 { |
163 { |
150 LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - aGuiType is canvas "); |
164 //MMIDCanvas |
151 aControl->iDeleteRefEvent = aDeleteRefEvent; |
165 MMIDCanvas* canvas = reinterpret_cast< MMIDCanvas* >(aComponent); |
|
166 |
152 |
167 CMMACanvasDisplay* canvasDisplay = |
153 CMMACanvasDisplay* canvasDisplay = |
168 CMMACanvasDisplay::NewLC(canvas); |
154 CMMACanvasDisplay::NewLC(aEventSource,javaDisplayRef); |
169 |
|
170 aControl->iDisplay = canvasDisplay; |
155 aControl->iDisplay = canvasDisplay; |
171 CleanupStack::Pop(canvasDisplay); |
156 CleanupStack::Pop(canvasDisplay); |
172 *aDisplayHandle = JavaMakeHandle(canvasDisplay); |
157 *aDisplayHandle = reinterpret_cast<TInt>(canvasDisplay); |
173 break; |
158 } |
174 } |
159 |
175 default: |
160 /* MMIDComponent::TType componentType = aComponent->Type(); |
176 { |
161 switch (componentType) |
177 // other component types are not supported |
162 { |
178 User::Leave(KErrNotSupported); |
163 case MMIDComponent::ECustomItem: |
179 } |
164 { |
180 |
165 //MMIDCustomItem // end of // 3.x QT based UI |
181 }*/ |
166 // MMIDCustomItem* customItem = |
|
167 // reinterpret_cast< MMIDCustomItem* >(aComponent); |
|
168 |
|
169 CMMAItemDisplay* itemDisplay = |
|
170 CMMAItemDisplay::NewLC(customItem); |
|
171 |
|
172 aControl->iDisplay = itemDisplay; |
|
173 CleanupStack::Pop(itemDisplay); |
|
174 *aDisplayHandle = JavaMakeHandle(itemDisplay); |
|
175 break; |
|
176 } |
|
177 case MMIDComponent::ECanvas: |
|
178 { |
|
179 //MMIDCanvas |
|
180 MMIDCanvas* canvas = reinterpret_cast< MMIDCanvas* >(aComponent); |
|
181 |
|
182 CMMACanvasDisplay* canvasDisplay = |
|
183 CMMACanvasDisplay::NewLC(canvas); |
|
184 |
|
185 aControl->iDisplay = canvasDisplay; |
|
186 CleanupStack::Pop(canvasDisplay); |
|
187 *aDisplayHandle = JavaMakeHandle(canvasDisplay); |
|
188 break; |
|
189 } |
|
190 default: |
|
191 { |
|
192 // other component types are not supported |
|
193 User::Leave(KErrNotSupported); |
|
194 } |
|
195 |
|
196 }*/ |
182 |
197 |
183 aControl->iGuiPlayer->SetDisplayL(aControl->iDisplay); |
198 aControl->iGuiPlayer->SetDisplayL(aControl->iDisplay); |
184 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - "); |
199 LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - "); |
185 } |
200 } |
186 |
201 |
187 |
202 |
188 void CMMAVideoControl::SetDisplayHandleToJavaPeer(MMAFunctionServer* eventSource ,jobject aJavaVideoControlPeer) |
203 void CMMAVideoControl::SetDisplayHandleToJavaPeer(MMAFunctionServer* eventSource ,jobject aJavaVideoControlPeer) |
189 { |
204 { |
190 JNIEnv* validJNI = eventSource->getValidJniEnv(); |
205 JNIEnv* validJNI = eventSource->getValidJniEnv(); |
191 |
206 |
192 jmethodID jmid = validJNI->GetMethodID( validJNI->GetObjectClass(aJavaVideoControlPeer), |
207 jmethodID jmid = validJNI->GetMethodID(validJNI->GetObjectClass(aJavaVideoControlPeer), |
193 "setNativeDisplayHandleToJavaPeer", |
208 "setNativeDisplayHandleToJavaPeer", |
194 "(I)V"); |
209 "(I)V"); |
195 // DEBUG_INT("CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID); |
210 // DEBUG_INT("CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID); |
196 TInt handle = reinterpret_cast<TInt>(iDisplay); |
211 TInt handle = reinterpret_cast<TInt>(iDisplay); |
197 validJNI->CallVoidMethod(aJavaVideoControlPeer,jmid,handle); |
212 validJNI->CallVoidMethod(aJavaVideoControlPeer,jmid,handle); |
198 iGuiPlayer->SetDisplayL(iDisplay); |
213 TRAP_IGNORE(iGuiPlayer->SetDisplayL(iDisplay)); |
199 } |
214 } |
200 |
215 |
201 void CMMAVideoControl::StaticInitDynamicModeL( |
216 void CMMAVideoControl::StaticInitDynamicModeL( |
202 CMMAVideoControl* aVideoControl, |
217 CMMAVideoControl* aVideoControl, |
203 TInt* aContentHandle, |
218 TInt* aContentHandle, |
215 MMMADirectContent* content = dcDisplay; |
230 MMMADirectContent* content = dcDisplay; |
216 *aContentHandle = reinterpret_cast< TInt >(content); |
231 *aContentHandle = reinterpret_cast< TInt >(content); |
217 aVideoControl->iDisplay = dcDisplay; |
232 aVideoControl->iDisplay = dcDisplay; |
218 aVideoControl->iGuiPlayer->SetDisplayL(aVideoControl->iDisplay); |
233 aVideoControl->iGuiPlayer->SetDisplayL(aVideoControl->iDisplay); |
219 CleanupStack::Pop(dcDisplay); |
234 CleanupStack::Pop(dcDisplay); |
220 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitDynamicModeL-"); |
235 LOG(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitDynamicModeL-"); |
221 } |
236 } |
222 |
237 |
223 void CMMAVideoControl::StaticGetPropertyL(CMMAVideoControl* aControl, |
238 void CMMAVideoControl::StaticGetPropertyL(CMMAVideoControl* /*aControl*/, |
224 TInt aPropertyType, |
239 TInt /*aPropertyType*/, |
225 TInt* aReturnValue) |
240 TInt* /*aReturnValue*/) |
226 { |
241 { |
227 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL property %d", |
242 // LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL property %d", |
228 aPropertyType); |
243 // aPropertyType); |
229 |
244 |
230 // MMAPI UI 3.x req. |
245 // MMAPI UI 3.x req. |
231 // remove the below return; once display is implemented in java |
246 // remove the below return and uncomment the below code once display is implemented in java |
232 return; |
247 return; |
233 |
248 |
234 |
249 /* |
235 MMMADisplay* display = aControl->iDisplay; |
250 MMMADisplay* display = aControl->iDisplay; |
236 |
251 |
237 if (aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH && |
252 if (aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH && |
238 aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT && |
253 aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT && |
239 !display) |
254 !display) |
240 { |
255 { |
241 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL not initialized yet"); |
256 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL not initialized yet"); |
242 // init is not done yet, returning 0 |
257 // init is not done yet, returning 0 |
243 *aReturnValue = 0; |
258 *aReturnValue = 0; |
244 return; |
259 return; |
245 } |
260 } |
246 |
261 |
247 switch (aPropertyType) |
262 switch (aPropertyType) |
248 { |
263 { |
249 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_WIDTH: |
264 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_WIDTH: |
250 { |
265 { |
251 *aReturnValue = display->DisplaySize().iWidth; |
266 *aReturnValue = display->DisplaySize().iWidth; |
252 break; |
267 break; |
253 } |
268 } |
254 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_HEIGHT: |
269 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_HEIGHT: |
255 { |
270 { |
256 *aReturnValue = display->DisplaySize().iHeight; |
271 *aReturnValue = display->DisplaySize().iHeight; |
257 break; |
272 break; |
258 } |
273 } |
259 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_X: |
274 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_X: |
260 { |
275 { |
261 *aReturnValue = display->DisplayLocation().iX; |
276 *aReturnValue = display->DisplayLocation().iX; |
262 break; |
277 break; |
263 } |
278 } |
264 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_Y: |
279 case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_Y: |
265 { |
280 { |
266 *aReturnValue = display->DisplayLocation().iY; |
281 *aReturnValue = display->DisplayLocation().iY; |
267 break; |
282 break; |
268 } |
283 } |
269 case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH: |
284 case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH: |
270 { |
285 { |
271 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source width"); |
286 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source width"); |
272 *aReturnValue = aControl->iGuiPlayer->SourceSize().iWidth; |
287 *aReturnValue = aControl->iGuiPlayer->SourceSize().iWidth; |
273 break; |
288 break; |
274 } |
289 } |
275 case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT: |
290 case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT: |
276 { |
291 { |
277 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source height"); |
292 LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source height"); |
278 *aReturnValue = aControl->iGuiPlayer->SourceSize().iHeight; |
293 *aReturnValue = aControl->iGuiPlayer->SourceSize().iHeight; |
279 break; |
294 break; |
280 } |
295 } |
281 default: |
296 default: |
282 { |
297 { |
283 *aReturnValue = KErrNotFound; |
298 *aReturnValue = KErrNotFound; |
284 User::Leave(KErrNotFound); |
299 User::Leave(KErrNotFound); |
285 break; |
300 break; |
286 } |
301 } |
287 } |
302 } |
288 } |
303 */ |
289 |
304 } |
290 |
305 |
291 void CMMAVideoControl::StaticSetPropertyL(CMMAVideoControl* aControl, |
306 |
292 TInt aPropertyType, |
307 void CMMAVideoControl::StaticSetPropertyL(CMMAVideoControl* /*aControl*/, |
293 TInt aPropertyA, |
308 TInt /*aPropertyType*/, |
294 TInt aPropertyB) |
309 TInt /*aPropertyA*/, |
295 { |
310 TInt /*aPropertyB*/) |
296 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL property type %d", |
311 { |
297 aPropertyType); |
312 //LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL property type %d", |
298 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL a property %d", |
313 // aPropertyType); |
299 aPropertyA); |
314 //LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL a property %d", |
300 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d", |
315 // aPropertyA); |
301 aPropertyB); |
316 // LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d", |
|
317 // aPropertyB); |
302 // MMAPI UI 3.x req. |
318 // MMAPI UI 3.x req. |
303 // remove the below return; once display is implemented in java |
319 // remove the below return and uncomment the below code; once display is implemented in java |
304 return; |
320 return; |
305 |
321 |
306 MMMADisplay* display = aControl->iDisplay; |
322 /* |
307 |
323 MMMADisplay* display = aControl->iDisplay; |
308 __ASSERT_DEBUG(display != NULL, |
324 |
309 User::Panic(_L("display not initialized"), KErrNotReady)); |
325 __ASSERT_DEBUG(display != NULL, |
310 |
326 User::Panic(_L("display not initialized"), KErrNotReady)); |
311 switch (aPropertyType) |
327 |
312 { |
328 switch (aPropertyType) |
313 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE: |
329 { |
314 { |
330 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE: |
315 TSize displaySize(aPropertyA, aPropertyB); |
331 { |
316 display->SetDisplaySizeL(displaySize); |
332 TSize displaySize(aPropertyA, aPropertyB); |
317 |
333 display->SetDisplaySizeL(displaySize); |
318 // inform java side |
334 |
319 if (!display->IsFullScreen()) |
335 // inform java side |
320 { |
336 if (!display->IsFullScreen()) |
321 aControl->iGuiPlayer->NotifyWithStringEvent( |
337 { |
322 CMMAPlayerEvent::ESizeChanged, KControlName); |
338 aControl->iGuiPlayer->NotifyWithStringEvent( |
323 } |
339 CMMAPlayerEvent::ESizeChanged, KControlName); |
324 break; |
340 } |
325 } |
341 break; |
326 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_LOCATION: |
342 } |
327 { |
343 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_LOCATION: |
328 TPoint displayLocation(aPropertyA, aPropertyB); |
344 { |
329 display->SetDisplayLocationL(displayLocation); |
345 TPoint displayLocation(aPropertyA, aPropertyB); |
330 break; |
346 display->SetDisplayLocationL(displayLocation); |
331 } |
347 break; |
332 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_TRUE: |
348 } |
333 { |
349 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_TRUE: |
334 display->SetVisible(ETrue); |
350 { |
335 break; |
351 display->SetVisible(ETrue); |
336 } |
352 break; |
337 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_FALSE: |
353 } |
338 { |
354 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_FALSE: |
339 display->SetVisible(EFalse); |
355 { |
340 break; |
356 display->SetVisible(EFalse); |
341 } |
357 break; |
342 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_TRUE: |
358 } |
343 { |
359 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_TRUE: |
344 // store old user rect to determine if SIZE_CHANGED event |
360 { |
345 // has to be delivered when full screen mode is turned off. |
361 // store old user rect to determine if SIZE_CHANGED event |
346 aControl->iOldDisplaySize = display->DisplaySize(); |
362 // has to be delivered when full screen mode is turned off. |
347 |
363 aControl->iOldDisplaySize = display->DisplaySize(); |
348 display->SetFullScreenL(ETrue); |
364 |
349 break; |
365 display->SetFullScreenL(ETrue); |
350 } |
366 break; |
351 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE: |
367 } |
352 { |
368 case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE: |
353 display->SetFullScreenL(EFalse); |
369 { |
354 |
370 display->SetFullScreenL(EFalse); |
355 // Send SIZE_CHANGED event when fullscreen is turned off if |
371 |
356 // size of the video display has changed. Possible position |
372 // Send SIZE_CHANGED event when fullscreen is turned off if |
357 // change is however disregarded |
373 // size of the video display has changed. Possible position |
358 if (aControl->iOldDisplaySize != display->DisplaySize()) |
374 // change is however disregarded |
359 { |
375 if (aControl->iOldDisplaySize != display->DisplaySize()) |
360 aControl->iGuiPlayer->NotifyWithStringEvent( |
376 { |
361 CMMAPlayerEvent::ESizeChanged, KControlName); |
377 aControl->iGuiPlayer->NotifyWithStringEvent( |
362 } |
378 CMMAPlayerEvent::ESizeChanged, KControlName); |
363 |
379 } |
364 break; |
380 |
365 } |
381 break; |
366 default: |
382 } |
367 { |
383 default: |
368 User::Leave(KErrNotFound); |
384 { |
369 break; |
385 User::Leave(KErrNotFound); |
370 } |
386 break; |
371 } |
387 } |
|
388 } |
|
389 */ |
372 } |
390 } |
373 |
391 |
374 |
392 |
375 void CMMAVideoControl::TakeSnapShotL(CMMAVideoControl* aControl, |
393 void CMMAVideoControl::TakeSnapShotL(CMMAVideoControl* aControl, |
376 const TDesC* aProperties) |
394 const TDesC* aProperties) |