|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of MPXVideoPlaybackControlConfiguration |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 11 % |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32def.h> |
|
23 #include <e32base.h> |
|
24 #include <AknUtils.h> |
|
25 |
|
26 #include "mpxvideoplaybackcontrolconfiguration.h" |
|
27 #include "mpxvideoplaybackcontrolscontroller.h" |
|
28 #include "mpxvideoplaybackviewfiledetails.h" |
|
29 #include "mpxvideo_debug.h" |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ============================================================== |
|
32 |
|
33 // ------------------------------------------------------------------------------------------------- |
|
34 // CMPXVideoPlaybackControlConfiguration::CMPXVideoPlaybackControlConfiguration() |
|
35 // C++ default constructor can NOT contain any code, that might leave. |
|
36 // ------------------------------------------------------------------------------------------------- |
|
37 // |
|
38 CMPXVideoPlaybackControlConfiguration::CMPXVideoPlaybackControlConfiguration( |
|
39 CMPXVideoPlaybackControlsController* aController) |
|
40 : iControlsController( aController ) |
|
41 { |
|
42 } |
|
43 |
|
44 // ------------------------------------------------------------------------------------------------- |
|
45 // CMPXVideoPlaybackControlConfiguration::ConstructL() |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ------------------------------------------------------------------------------------------------- |
|
48 // |
|
49 void CMPXVideoPlaybackControlConfiguration::ConstructL() |
|
50 { |
|
51 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::ConstructL()")); |
|
52 |
|
53 CreateControlListL(); |
|
54 } |
|
55 |
|
56 // ------------------------------------------------------------------------------------------------- |
|
57 // CMPXVideoPlaybackControlConfiguration::NewL() |
|
58 // Two-phased constructor. |
|
59 // ------------------------------------------------------------------------------------------------- |
|
60 // |
|
61 CMPXVideoPlaybackControlConfiguration* |
|
62 CMPXVideoPlaybackControlConfiguration::NewL( CMPXVideoPlaybackControlsController* aController ) |
|
63 { |
|
64 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::NewL()")); |
|
65 |
|
66 CMPXVideoPlaybackControlConfiguration* self = |
|
67 new (ELeave) CMPXVideoPlaybackControlConfiguration( aController ); |
|
68 |
|
69 CleanupStack::PushL(self); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop(); |
|
72 |
|
73 return self; |
|
74 } |
|
75 |
|
76 // ------------------------------------------------------------------------------------------------- |
|
77 // CMPXVideoPlaybackControlConfiguration::~CMPXVideoPlaybackControlConfiguration() |
|
78 // Destructor. |
|
79 // ------------------------------------------------------------------------------------------------- |
|
80 // |
|
81 CMPXVideoPlaybackControlConfiguration::~CMPXVideoPlaybackControlConfiguration() |
|
82 { |
|
83 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::~CMPXVideoPlaybackControlConfiguration")); |
|
84 |
|
85 iControlsList.Reset(); |
|
86 } |
|
87 |
|
88 // ------------------------------------------------------------------------------------------------- |
|
89 // CMPXVideoPlaybackControlConfiguration::CreateControlListL() |
|
90 // ------------------------------------------------------------------------------------------------- |
|
91 // |
|
92 void CMPXVideoPlaybackControlConfiguration::CreateControlListL() |
|
93 { |
|
94 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::CreateControlListL()")); |
|
95 |
|
96 CMPXVideoPlaybackViewFileDetails* fileDetails = iControlsController->FileDetails(); |
|
97 |
|
98 if ( fileDetails->iPlaybackMode == EMPXVideoStreaming ) |
|
99 { |
|
100 // |
|
101 // streaming mode, add branding animation control to show while initializing |
|
102 // |
|
103 iControlsList.AppendL( EMPXBrandingAnimation ); |
|
104 } |
|
105 else if ( fileDetails->iRNFormat ) |
|
106 { |
|
107 // |
|
108 // RN clip and local mode, add RN logo bitmap to show while initializing |
|
109 // |
|
110 iControlsController->SetRealOneBitmapVisibility( ETrue ); |
|
111 } |
|
112 |
|
113 iControlsList.AppendL( EMPXSoftkeyDetails ); |
|
114 iControlsList.AppendL( EMPXSoftkeyBack ); |
|
115 iControlsList.AppendL( EMPXProgressBar ); |
|
116 iControlsList.AppendL( EMPXVolumeBar ); |
|
117 iControlsList.AppendL( EMPXBufferingLabel ); |
|
118 |
|
119 if ( AknLayoutUtils::PenEnabled() ) |
|
120 { |
|
121 iControlsList.AppendL( EMPXButtonBar ); |
|
122 } |
|
123 else |
|
124 { |
|
125 iControlsList.AppendL( EMPXVideoPausedIcon ); |
|
126 } |
|
127 } |
|
128 |
|
129 // ------------------------------------------------------------------------------------------------- |
|
130 // CMPXVideoPlaybackControlConfiguration::ControlList |
|
131 // ------------------------------------------------------------------------------------------------- |
|
132 // |
|
133 RArray<TMPXVideoPlaybackControls>& CMPXVideoPlaybackControlConfiguration::ControlList() |
|
134 { |
|
135 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::ControlList()")); |
|
136 |
|
137 return iControlsList; |
|
138 } |
|
139 |
|
140 // ------------------------------------------------------------------------------------------------- |
|
141 // CMPXVideoPlaybackControlConfiguration::UpdateControlListL |
|
142 // ------------------------------------------------------------------------------------------------- |
|
143 // |
|
144 void CMPXVideoPlaybackControlConfiguration::UpdateControlListL( |
|
145 TMPXVideoPlaybackControlCommandIds aEvent ) |
|
146 { |
|
147 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::UpdateControlListL(%d)"), aEvent); |
|
148 |
|
149 // |
|
150 // This fuction will be getting called |
|
151 // - After Initialization complete |
|
152 // - When TV-out cable get connected/disconnected |
|
153 // - When enters/exits aspect ratio mode |
|
154 // |
|
155 switch ( aEvent ) |
|
156 { |
|
157 case EMPXControlCmdSetDownloadPaused: |
|
158 { |
|
159 if ( ! iDownloadPausedAdded ) |
|
160 { |
|
161 iControlsList.AppendL( EMPXDownloadPausedIcon ); |
|
162 |
|
163 iDownloadPausedAdded = ETrue; |
|
164 } |
|
165 |
|
166 break; |
|
167 } |
|
168 case EMPXControlCmdClearDownloadPaused: |
|
169 { |
|
170 if ( iDownloadPausedAdded ) |
|
171 { |
|
172 DeleteControlFromList( EMPXDownloadPausedIcon ); |
|
173 |
|
174 iDownloadPausedAdded = EFalse; |
|
175 } |
|
176 |
|
177 break; |
|
178 } |
|
179 case EMPXControlCmdTvOutConnected: |
|
180 { |
|
181 if ( ! iTitleArtistIndicatorsAdded ) |
|
182 { |
|
183 iControlsList.AppendL( EMPXTitleLabel ); |
|
184 iControlsList.AppendL( EMPXArtistLabel ); |
|
185 |
|
186 iTitleArtistIndicatorsAdded = ETrue; |
|
187 } |
|
188 |
|
189 if ( iAspectRatioIconAdded ) |
|
190 { |
|
191 DeleteControlFromList( EMPXAspectRatioIcon ); |
|
192 iAspectRatioIconAdded = EFalse; |
|
193 } |
|
194 |
|
195 break; |
|
196 } |
|
197 case EMPXControlCmdTvOutDisconnected: |
|
198 { |
|
199 if ( iControlsController->FileDetails()->iVideoEnabled ) |
|
200 { |
|
201 if ( iTitleArtistIndicatorsAdded ) |
|
202 { |
|
203 DeleteControlFromList( EMPXTitleLabel ); |
|
204 DeleteControlFromList( EMPXArtistLabel ); |
|
205 |
|
206 iTitleArtistIndicatorsAdded = EFalse; |
|
207 } |
|
208 |
|
209 if ( ! iAspectRatioIconAdded && |
|
210 iControlsController->FileDetails()->iVideoHeight > 0 && |
|
211 iControlsController->FileDetails()->iVideoWidth > 0 ) |
|
212 { |
|
213 iControlsList.AppendL( EMPXAspectRatioIcon ); |
|
214 iAspectRatioIconAdded = ETrue; |
|
215 } |
|
216 } |
|
217 break; |
|
218 } |
|
219 case EMPXControlCmdPluginInitialized: |
|
220 { |
|
221 if ( iControlsController->FileDetails()->iPlaybackMode == EMPXVideoStreaming || |
|
222 iControlsController->FileDetails()->iPlaybackMode == EMPXVideoLiveStreaming ) |
|
223 { |
|
224 DeleteControlFromList( EMPXBrandingAnimation ); |
|
225 } |
|
226 |
|
227 break; |
|
228 } |
|
229 default: |
|
230 { |
|
231 break; |
|
232 } |
|
233 } |
|
234 } |
|
235 |
|
236 // ------------------------------------------------------------------------------------------------- |
|
237 // CMPXVideoPlaybackControlConfiguration::DeleteControlFromList |
|
238 // ------------------------------------------------------------------------------------------------- |
|
239 // |
|
240 void CMPXVideoPlaybackControlConfiguration::DeleteControlFromList( |
|
241 TMPXVideoPlaybackControls aControl ) |
|
242 { |
|
243 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::DeleteControlFromList(%d)"), aControl); |
|
244 |
|
245 TInt index = iControlsList.Find( aControl ); |
|
246 |
|
247 if ( index != KErrNotFound ) |
|
248 { |
|
249 iControlsList.Remove( index ); |
|
250 } |
|
251 } |
|
252 |
|
253 // ------------------------------------------------------------------------------------------------- |
|
254 // CMPXVideoPlaybackControlConfiguration::UpdateControlsWithFileDetailsL |
|
255 // ------------------------------------------------------------------------------------------------- |
|
256 // |
|
257 void CMPXVideoPlaybackControlConfiguration::UpdateControlsWithFileDetailsL() |
|
258 { |
|
259 MPX_DEBUG(_L("CMPXVideoPlaybackControlConfiguration::UpdateControlsWithFileDetailsL()")); |
|
260 |
|
261 CMPXVideoPlaybackViewFileDetails* fileDetails = iControlsController->FileDetails(); |
|
262 |
|
263 if ( fileDetails->iVideoEnabled ) |
|
264 { |
|
265 if ( iAudioOnlyIndicatorsAdded ) |
|
266 { |
|
267 DeleteControlFromList( EMPXRealAudioBitmap ); |
|
268 DeleteControlFromList( EMPXSoundBitmap ); |
|
269 DeleteControlFromList( EMPXNoVideoBitmap ); |
|
270 |
|
271 iAudioOnlyIndicatorsAdded = EFalse; |
|
272 } |
|
273 |
|
274 if ( fileDetails->iTvOutConnected ) |
|
275 { |
|
276 if ( ! iTitleArtistIndicatorsAdded ) |
|
277 { |
|
278 iControlsList.AppendL( EMPXTitleLabel ); |
|
279 iControlsList.AppendL( EMPXArtistLabel ); |
|
280 |
|
281 iTitleArtistIndicatorsAdded = ETrue; |
|
282 } |
|
283 |
|
284 if ( iAspectRatioIconAdded ) |
|
285 { |
|
286 DeleteControlFromList( EMPXAspectRatioIcon ); |
|
287 iAspectRatioIconAdded = EFalse; |
|
288 } |
|
289 } |
|
290 else |
|
291 { |
|
292 if ( iTitleArtistIndicatorsAdded ) |
|
293 { |
|
294 DeleteControlFromList( EMPXTitleLabel ); |
|
295 DeleteControlFromList( EMPXArtistLabel ); |
|
296 |
|
297 iTitleArtistIndicatorsAdded = EFalse; |
|
298 } |
|
299 |
|
300 // |
|
301 // If video is enabled, add aspect ratio icon |
|
302 // |
|
303 if ( ! iAspectRatioIconAdded && |
|
304 fileDetails->iVideoHeight > 0 && |
|
305 fileDetails->iVideoWidth > 0 && |
|
306 AknLayoutUtils::PenEnabled() ) |
|
307 { |
|
308 iControlsList.AppendL( EMPXAspectRatioIcon ); |
|
309 iAspectRatioIconAdded = ETrue; |
|
310 } |
|
311 } |
|
312 } |
|
313 else |
|
314 { |
|
315 // |
|
316 // No video for this clip |
|
317 // |
|
318 |
|
319 // |
|
320 // Remove the Real One bitmap and show the audio only bitmaps |
|
321 // |
|
322 iControlsController->SetRealOneBitmapVisibility( EFalse ); |
|
323 |
|
324 if ( ! iAudioOnlyIndicatorsAdded ) |
|
325 { |
|
326 if ( fileDetails->iRNFormat ) |
|
327 { |
|
328 iControlsList.AppendL( EMPXRealAudioBitmap ); |
|
329 } |
|
330 |
|
331 // |
|
332 // this media clip doesn't have a supported video stream, |
|
333 // display "No Video" bitmap instead of |
|
334 // the generic "Sound" bitmap |
|
335 // |
|
336 if ( fileDetails->iPartialPlayback ) |
|
337 { |
|
338 iControlsList.AppendL( EMPXNoVideoBitmap ); |
|
339 } |
|
340 else |
|
341 { |
|
342 iControlsList.AppendL( EMPXSoundBitmap ); |
|
343 } |
|
344 |
|
345 iAudioOnlyIndicatorsAdded = ETrue; |
|
346 } |
|
347 |
|
348 if ( ! iTitleArtistIndicatorsAdded ) |
|
349 { |
|
350 iControlsList.AppendL( EMPXTitleLabel ); |
|
351 iControlsList.AppendL( EMPXArtistLabel ); |
|
352 |
|
353 iTitleArtistIndicatorsAdded = ETrue; |
|
354 } |
|
355 |
|
356 // |
|
357 // If video isn't enable, delete aspect ratio icon |
|
358 // |
|
359 if ( iAspectRatioIconAdded ) |
|
360 { |
|
361 DeleteControlFromList( EMPXAspectRatioIcon ); |
|
362 iAspectRatioIconAdded = EFalse; |
|
363 } |
|
364 } |
|
365 } |
|
366 |
|
367 |
|
368 // End of File |