27 #include "glxhdmicontroller.h" |
27 #include "glxhdmicontroller.h" |
28 |
28 |
29 // ----------------------------------------------------------------------------- |
29 // ----------------------------------------------------------------------------- |
30 // NewLC |
30 // NewLC |
31 // ----------------------------------------------------------------------------- |
31 // ----------------------------------------------------------------------------- |
32 EXPORT_C CGlxHdmiController* CGlxHdmiController::NewL(const TDesC& aImageFile) |
32 EXPORT_C CGlxHdmiController* CGlxHdmiController::NewL() |
33 { |
33 { |
34 TRACER("CGlxHdmiController* CGlxHdmiController::NewL()"); |
34 TRACER("CGlxHdmiController* CGlxHdmiController::NewL()"); |
35 CGlxHdmiController* self = new (ELeave) CGlxHdmiController(aImageFile); |
35 CGlxHdmiController* self = new (ELeave) CGlxHdmiController(); |
36 CleanupStack::PushL(self); |
36 CleanupStack::PushL(self); |
37 self->ConstructL(); |
37 self->ConstructL(); |
38 CleanupStack::Pop(self); |
38 CleanupStack::Pop(self); |
39 return self; |
39 return self; |
40 } |
40 } |
57 |
57 |
58 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
59 // Setting an Image Path |
59 // Setting an Image Path |
60 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
61 EXPORT_C void CGlxHdmiController::SetImageL(const TDesC& aImageFile, |
61 EXPORT_C void CGlxHdmiController::SetImageL(const TDesC& aImageFile, |
62 TSize aImageDimensions, TInt aFrameCount, TBool aStore) |
62 TBool aStore) |
63 { |
63 { |
64 TRACER("CGlxHdmiController::SetImageL()"); |
64 TRACER("CGlxHdmiController::SetImageL()"); |
65 if (aStore) |
65 if (aStore) |
66 { |
66 { |
67 iImageSupported = ETrue; |
67 iIsImageSupported = ETrue; |
68 StoreImageInfoL(aImageFile, aImageDimensions, aFrameCount); |
68 StoreImageInfoL(aImageFile); |
69 } |
69 } |
70 if (iGlxTvOut->IsHDMIConnected()) |
70 if (iGlxTvOut->IsHDMIConnected()) |
71 { |
71 { |
|
72 iIsPostingMode = ETrue; |
72 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 2"); |
73 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 2"); |
73 // do not close the surface , use the same surface instead. |
74 // do not close the surface , use the same surface instead. |
74 // Call a function to pass imagefile, imagedimension, framecount |
75 // Call a function to pass imagefile |
75 if (!iHdmiContainer) |
76 if (!iHdmiContainer) |
76 { |
77 { |
77 CreateHdmiContainerL(); |
78 CreateHdmiContainerL(); |
78 } |
79 } |
79 if (!iSurfaceUpdater) |
80 if (!iSurfaceUpdater) |
80 { |
81 { |
81 // This case would come when surface updater is not created at the first instance and also |
82 // This case would come when surface updater is not created at the first instance and also |
82 // it satisfies the 720p condition |
83 // it satisfies the 720p condition |
83 CreateSurfaceUpdaterL(aImageFile, aImageDimensions, aFrameCount); |
84 CreateSurfaceUpdaterL(aImageFile); |
84 } |
85 } |
85 else |
86 else |
86 { |
87 { |
87 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 3"); |
88 GLX_LOG_INFO("CGlxHdmiController::SetImageL() - 3"); |
88 iSurfaceUpdater->UpdateNewImageL(aImageFile, aFrameCount,aImageDimensions); |
89 iSurfaceUpdater->UpdateNewImageL(aImageFile); |
89 } |
90 } |
90 iHdmiContainer->DrawNow(); |
91 iHdmiContainer->DrawNow(); |
91 } |
92 } |
92 } |
93 } |
93 |
94 |
145 // ShiftToPostingMode |
147 // ShiftToPostingMode |
146 // ----------------------------------------------------------------------------- |
148 // ----------------------------------------------------------------------------- |
147 EXPORT_C void CGlxHdmiController::ShiftToPostingMode() |
149 EXPORT_C void CGlxHdmiController::ShiftToPostingMode() |
148 { |
150 { |
149 TRACER("CGlxHdmiController::ShiftToPostingMode()"); |
151 TRACER("CGlxHdmiController::ShiftToPostingMode()"); |
|
152 iIsPostingMode = ETrue; |
150 if (iGlxTvOut->IsHDMIConnected() && iSurfaceUpdater) |
153 if (iGlxTvOut->IsHDMIConnected() && iSurfaceUpdater) |
151 { |
154 { |
152 iSurfaceUpdater->ShiftToPostingMode(); |
155 iSurfaceUpdater->ShiftToPostingMode(); |
153 } |
156 } |
154 } |
157 } |
155 |
158 |
156 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
157 // Constructor |
160 // Constructor |
158 // ----------------------------------------------------------------------------- |
161 // ----------------------------------------------------------------------------- |
159 CGlxHdmiController::CGlxHdmiController(const TDesC& aImageFile): |
162 CGlxHdmiController::CGlxHdmiController(): |
160 iImagePath(aImageFile) |
163 iIsPostingMode(EFalse) |
161 { |
164 { |
162 TRACER("CGlxHdmiController::CGlxHdmiController()"); |
165 TRACER("CGlxHdmiController::CGlxHdmiController()"); |
163 // Implement nothing here |
166 // Implement nothing here |
164 } |
167 } |
165 |
168 |
211 } |
214 } |
212 |
215 |
213 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
214 // CreateSurfaceUpdaterL |
217 // CreateSurfaceUpdaterL |
215 // ----------------------------------------------------------------------------- |
218 // ----------------------------------------------------------------------------- |
216 void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile, |
219 void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile) |
217 TSize aImageDimensions, TInt aFrameCount) |
|
218 { |
220 { |
219 TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); |
221 TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); |
220 RWindow* window = iHdmiContainer->GetWindow(); |
222 RWindow* window = iHdmiContainer->GetWindow(); |
221 iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, aImageDimensions, |
223 iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, |
222 aFrameCount, iHdmiContainer); |
224 iHdmiContainer); |
223 iHdmiContainer->DrawNow(); |
225 iHdmiContainer->DrawNow(); |
224 } |
226 } |
225 |
227 |
226 // ----------------------------------------------------------------------------- |
228 // ----------------------------------------------------------------------------- |
227 // StoreImageInfoL |
229 // StoreImageInfoL |
228 // ----------------------------------------------------------------------------- |
230 // ----------------------------------------------------------------------------- |
229 void CGlxHdmiController::StoreImageInfoL(const TDesC& aImageFile, |
231 void CGlxHdmiController::StoreImageInfoL(const TDesC& aImageFile) |
230 TSize aImageDimensions, TInt aFrameCount) |
|
231 { |
232 { |
232 TRACER("CGlxHdmiController::StoreImageInfoL()"); |
233 TRACER("CGlxHdmiController::StoreImageInfoL()"); |
233 if(iStoredImagePath) |
234 if(iStoredImagePath) |
234 { |
235 { |
235 delete iStoredImagePath; |
236 delete iStoredImagePath; |
236 iStoredImagePath = NULL; |
237 iStoredImagePath = NULL; |
237 } |
238 } |
238 iStoredImagePath = aImageFile.AllocL(); |
239 iStoredImagePath = aImageFile.AllocL(); |
239 iImageDimensions = aImageDimensions; |
|
240 iFrameCount = aFrameCount; |
|
241 } |
240 } |
242 |
241 |
243 // ----------------------------------------------------------------------------- |
242 // ----------------------------------------------------------------------------- |
244 // HandleTvStatusChangedL |
243 // HandleTvStatusChangedL |
245 // ----------------------------------------------------------------------------- |
244 // ----------------------------------------------------------------------------- |
246 void CGlxHdmiController::HandleTvStatusChangedL( TTvChangeType aChangeType ) |
245 void CGlxHdmiController::HandleTvStatusChangedL( TTvChangeType aChangeType ) |
247 { |
246 { |
248 TRACER("CGlxHdmiController::HandleTvStatusChangedL()"); |
247 TRACER("CGlxHdmiController::HandleTvStatusChangedL()"); |
249 if ( aChangeType == ETvConnectionChanged ) |
248 if ( aChangeType == ETvConnectionChanged ) |
250 { |
249 { |
251 if ( iGlxTvOut->IsHDMIConnected() && iImageSupported) |
250 if ( iGlxTvOut->IsHDMIConnected() && iIsImageSupported && iIsPostingMode) |
252 { |
251 { |
253 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Connected"); |
252 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Connected"); |
254 // Calling SetImageL() with appropriate parameters |
253 // Calling SetImageL() with appropriate parameters |
255 SetImageL(iStoredImagePath->Des(), iImageDimensions, iFrameCount, EFalse); |
254 SetImageL(iStoredImagePath->Des(), EFalse); |
256 } |
255 } |
257 else |
256 else |
258 { |
257 { |
259 // if it gets disconnected, destroy the surface |
258 // if it gets disconnected, destroy the surface |
260 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Not Connected"); |
259 GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Not Connected"); |