45 { |
47 { |
46 TRACER("CGlxHdmiController::~CGlxHdmiController()"); |
48 TRACER("CGlxHdmiController::~CGlxHdmiController()"); |
47 DestroySurfaceUpdater(); |
49 DestroySurfaceUpdater(); |
48 DestroyContainer(); |
50 DestroyContainer(); |
49 delete iStoredImagePath; |
51 delete iStoredImagePath; |
50 iStoredImagePath = NULL; |
52 delete iStoredNextImagePath; |
51 if (iFsBitmap) |
53 if (iFsBitmap) |
52 { |
54 { |
53 delete iFsBitmap; |
55 delete iFsBitmap; |
54 iFsBitmap = NULL; |
56 } |
55 } |
57 if (iGlxTvOut) |
56 if(iGlxTvOut) |
58 { |
57 { |
|
58 delete iGlxTvOut; |
59 delete iGlxTvOut; |
59 } |
60 } |
60 } |
61 } |
61 |
62 |
62 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
63 // Setting an Image Path |
64 // Setting an Image Path |
64 // ----------------------------------------------------------------------------- |
65 // ----------------------------------------------------------------------------- |
65 EXPORT_C void CGlxHdmiController::SetImageL(const TDesC& aImageFile, CFbsBitmap* aFsBitmap, |
66 EXPORT_C void CGlxHdmiController::SetImageL(const TDesC& aImageFile, |
66 TBool aStore) |
67 const TDesC& aNextImageFile, CFbsBitmap* aFsBitmap, TBool aStore) |
67 { |
68 { |
68 TRACER("CGlxHdmiController::SetImageL()"); |
69 TRACER("CGlxHdmiController::SetImageL()"); |
69 if (aFsBitmap == NULL || !aImageFile.Length()) |
70 if (aFsBitmap == NULL || !aImageFile.Length()) |
70 { |
71 { |
71 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - NULL Uri"); |
72 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - NULL Uri"); |
72 return; |
73 return; |
73 } |
74 } |
74 if (aStore) |
75 if (aStore) |
75 { |
76 { |
76 iIsImageSupported = ETrue; |
77 iIsImageSupported = ETrue; |
77 StoreImageInfoL( aImageFile, aFsBitmap ); |
78 StoreImageInfoL(aImageFile, aNextImageFile, aFsBitmap); |
78 } |
79 } |
79 if (iGlxTvOut->IsHDMIConnected()) |
80 if (iGlxTvOut->IsHDMIConnected()) |
80 { |
81 { |
81 iIsPhotosInForeground = ETrue; // the image should be in posting mode |
82 iIsPhotosInForeground = ETrue; // the image should be in posting mode |
82 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 2"); |
83 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 2"); |
83 // do not close the surface , use the same surface instead. |
84 // do not close the surface , use the same surface instead. |
84 // Call a function to pass imagefile |
85 // Call a function to pass imagefile |
85 if (!iHdmiContainer) |
86 if (!iHdmiContainer) |
86 { |
87 { |
87 CreateHdmiContainerL(); |
88 CreateHdmiContainerL(); |
88 } |
89 } |
89 if (!iSurfaceUpdater) |
90 if (!iSurfaceUpdater) |
90 { |
91 { |
91 // This case would come when surface updater is not created at the first instance and also |
92 // This case would come when surface updater is not created at the first instance and also |
92 // it satisfies the 720p condition |
93 // it satisfies the 720p condition |
93 CreateSurfaceUpdaterL(aImageFile); |
94 CreateSurfaceUpdaterL(aImageFile, aNextImageFile); |
94 } |
95 } |
95 else |
96 else |
96 { |
97 { |
97 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 3"); |
98 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 3"); |
98 iSurfaceUpdater->UpdateNewImageL(aImageFile, aFsBitmap); |
99 iSurfaceUpdater->UpdateNewImageL(aImageFile, aNextImageFile, |
|
100 aFsBitmap); |
99 } |
101 } |
100 iHdmiContainer->DrawNow(); |
102 iHdmiContainer->DrawNow(); |
101 } |
103 } |
102 } |
104 } |
103 |
105 |
187 // IsHDMIConnected |
189 // IsHDMIConnected |
188 // ----------------------------------------------------------------------------- |
190 // ----------------------------------------------------------------------------- |
189 EXPORT_C TBool CGlxHdmiController::IsHDMIConnected() |
191 EXPORT_C TBool CGlxHdmiController::IsHDMIConnected() |
190 { |
192 { |
191 TRACER("CGlxHdmiController::IsHDMIConnected()"); |
193 TRACER("CGlxHdmiController::IsHDMIConnected()"); |
192 return iGlxTvOut->IsHDMIConnected(); |
194 return iGlxTvOut->IsHDMIConnected(); |
193 } |
195 } |
194 |
|
195 |
196 |
196 // ----------------------------------------------------------------------------- |
197 // ----------------------------------------------------------------------------- |
197 // Constructor |
198 // Constructor |
198 // ----------------------------------------------------------------------------- |
199 // ----------------------------------------------------------------------------- |
199 CGlxHdmiController::CGlxHdmiController(): |
200 CGlxHdmiController::CGlxHdmiController( |
200 iFsBitmap(NULL), |
201 MGlxHDMIDecoderObserver& aDecoderObserver) : |
201 iStoredImagePath(NULL), |
202 iFsBitmap(NULL), iStoredImagePath(NULL), iStoredNextImagePath(NULL), |
202 iIsPhotosInForeground(EFalse) |
203 iIsPhotosInForeground(EFalse), iDecoderObserver(aDecoderObserver) |
203 { |
204 { |
204 TRACER("CGlxHdmiController::CGlxHdmiController()"); |
205 TRACER("CGlxHdmiController::CGlxHdmiController()"); |
205 // Implement nothing here |
206 // Implement nothing here |
206 } |
207 } |
207 |
208 |
252 } |
254 } |
253 |
255 |
254 // ----------------------------------------------------------------------------- |
256 // ----------------------------------------------------------------------------- |
255 // CreateSurfaceUpdaterL |
257 // CreateSurfaceUpdaterL |
256 // ----------------------------------------------------------------------------- |
258 // ----------------------------------------------------------------------------- |
257 void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile) |
259 void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile, |
|
260 const TDesC& aNextImageFile) |
258 { |
261 { |
259 TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); |
262 TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); |
260 RWindow* window = iHdmiContainer->GetWindow(); |
263 RWindow* window = iHdmiContainer->GetWindow(); |
261 iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, iFsBitmap, |
264 iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, |
262 iHdmiContainer); |
265 aNextImageFile, iFsBitmap, iHdmiContainer, iDecoderObserver); |
263 iHdmiContainer->DrawNow(); |
266 iHdmiContainer->DrawNow(); |
264 } |
267 } |
265 |
268 |
266 // ----------------------------------------------------------------------------- |
269 // ----------------------------------------------------------------------------- |
267 // StoreImageInfoL |
270 // StoreImageInfoL |
268 // ----------------------------------------------------------------------------- |
271 // ----------------------------------------------------------------------------- |
269 void CGlxHdmiController::StoreImageInfoL(const TDesC& aImageFile, CFbsBitmap* aFsBitmap) |
272 void CGlxHdmiController::StoreImageInfoL(const TDesC& aImageFile, |
|
273 const TDesC& aNextImageFile, CFbsBitmap* aFsBitmap) |
270 { |
274 { |
271 TRACER("CGlxHdmiController::StoreImageInfoL()"); |
275 TRACER("CGlxHdmiController::StoreImageInfoL()"); |
272 if(iStoredImagePath) |
276 if (iStoredImagePath) |
273 { |
277 { |
274 delete iStoredImagePath; |
278 delete iStoredImagePath; |
275 iStoredImagePath = NULL; |
279 iStoredImagePath = NULL; |
276 } |
280 } |
|
281 if (iStoredNextImagePath) |
|
282 { |
|
283 delete iStoredNextImagePath; |
|
284 iStoredNextImagePath = NULL; |
|
285 } |
277 if (iFsBitmap) |
286 if (iFsBitmap) |
278 { |
287 { |
279 delete iFsBitmap; |
288 delete iFsBitmap; |
280 iFsBitmap = NULL; |
289 iFsBitmap = NULL; |
281 } |
290 } |
282 iStoredImagePath = aImageFile.AllocL(); |
291 iStoredImagePath = aImageFile.AllocL(); |
|
292 iStoredNextImagePath = aNextImageFile.AllocL(); |
283 iFsBitmap = new (ELeave) CFbsBitmap; |
293 iFsBitmap = new (ELeave) CFbsBitmap; |
284 iFsBitmap->Duplicate(aFsBitmap->Handle()); |
294 iFsBitmap->Duplicate(aFsBitmap->Handle()); |
285 } |
295 } |
286 |
296 |
287 // ----------------------------------------------------------------------------- |
297 // ----------------------------------------------------------------------------- |
288 // HandleTvStatusChangedL |
298 // HandleTvStatusChangedL |
289 // ----------------------------------------------------------------------------- |
299 // ----------------------------------------------------------------------------- |
290 void CGlxHdmiController::HandleTvStatusChangedL( TTvChangeType aChangeType ) |
300 void CGlxHdmiController::HandleTvStatusChangedL(TTvChangeType aChangeType) |
291 { |
301 { |
292 TRACER("CGlxHdmiController::HandleTvStatusChangedL()"); |
302 TRACER("CGlxHdmiController::HandleTvStatusChangedL()"); |
293 if ( aChangeType == ETvConnectionChanged ) |
303 if (aChangeType == ETvConnectionChanged) |
294 { |
304 { |
295 if ( iGlxTvOut->IsHDMIConnected() && iGlxTvOut->IsConnected() && iSurfaceUpdater) |
305 if (iGlxTvOut->IsHDMIConnected() && iGlxTvOut->IsConnected() |
296 { |
306 && iSurfaceUpdater) |
297 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI and TV Connected"); |
307 { |
|
308 GLX_LOG_INFO( |
|
309 "CGlxHdmiController::HandleTvStatusChangedL() - HDMI and TV Connected"); |
298 // Do nothing , as this means HDMI is already connected and headset/tv cable connected |
310 // Do nothing , as this means HDMI is already connected and headset/tv cable connected |
299 // meaning we shouldnt destroy HDMI and neither have to create surface updater. |
311 // meaning we shouldnt destroy HDMI and neither have to create surface updater. |
300 return; |
312 return; |
301 } |
313 } |
302 else if ( iGlxTvOut->IsHDMIConnected() && iIsImageSupported && iIsPhotosInForeground) |
314 else if (iGlxTvOut->IsHDMIConnected() && iIsImageSupported |
303 { |
315 && iIsPhotosInForeground) |
304 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Connected"); |
316 { |
|
317 GLX_LOG_INFO( |
|
318 "CGlxHdmiController::HandleTvStatusChangedL() - HDMI Connected"); |
305 // Calling SetImageL() with appropriate parameters |
319 // Calling SetImageL() with appropriate parameters |
306 SetImageL(iStoredImagePath->Des(), iFsBitmap, EFalse); |
320 if (iStoredNextImagePath) |
|
321 { |
|
322 SetImageL(iStoredImagePath->Des(), |
|
323 iStoredNextImagePath->Des(), iFsBitmap, EFalse); |
|
324 } |
|
325 else |
|
326 { |
|
327 SetImageL(iStoredImagePath->Des(), KNullDesC, iFsBitmap, |
|
328 EFalse); |
|
329 } |
307 } |
330 } |
308 else |
331 else |
309 { |
332 { |
310 GLX_LOG_INFO3("CGlxHdmiController::HandleTvStatusChangedL() iIsImageSupported=%d, iGlxTvOut->IsHDMIConnected()=%d, iIsPostingMode=%d", |
333 GLX_LOG_INFO3( |
311 iIsImageSupported,iGlxTvOut->IsHDMIConnected(),iIsPhotosInForeground); |
334 "CGlxHdmiController::HandleTvStatusChangedL() iIsImageSupported=%d, iGlxTvOut->IsHDMIConnected()=%d, iIsPostingMode=%d", |
|
335 iIsImageSupported, iGlxTvOut->IsHDMIConnected(), |
|
336 iIsPhotosInForeground); |
312 // if it gets disconnected, destroy the surface |
337 // if it gets disconnected, destroy the surface |
313 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Not Connected"); |
338 GLX_LOG_INFO( |
|
339 "CGlxHdmiController::HandleTvStatusChangedL() - HDMI Not Connected"); |
314 DestroySurfaceUpdater(); |
340 DestroySurfaceUpdater(); |
315 } |
341 } |
316 } |
342 } |
317 } |
343 } |
318 |
344 |