|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Implements rendering of the Image/Video |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GLXUPNPRENDERERIMPL_H__ |
|
22 #define C_GLXUPNPRENDERERIMPL_H__ |
|
23 |
|
24 #include "glxupnprendererdefs.h" |
|
25 #include "glxupnpthumbnailsaver.h" |
|
26 |
|
27 //External Includes |
|
28 #include <mglxactivemedialistchangeobserver.h> |
|
29 #include <mglxactivemedialistresolver.h> |
|
30 #include <mglxmedialistobserver.h> |
|
31 |
|
32 //for upnp show command |
|
33 #include <upnpshowcommand.h> |
|
34 #include <upnpcommandobserver.h> |
|
35 |
|
36 |
|
37 #include <glxmediaid.h> |
|
38 #include <mglxmedialist.h> //for medialist |
|
39 |
|
40 //Forward Declarations |
|
41 class MGlxMediaList; |
|
42 class CGlxDefaultAttributeContext; |
|
43 class CGlxDefaultThumbnailContext; |
|
44 class TGlxMediaId; |
|
45 class CImageEncoder; |
|
46 class MGlxThumbnailSaveComplete; |
|
47 class CGlxThumbnailSaver; |
|
48 |
|
49 /** |
|
50 * Implements the renderering of the image/video |
|
51 * |
|
52 * @lib glxupnpcommandhandler.lib |
|
53 */ |
|
54 |
|
55 NONSHARABLE_CLASS( CGlxUpnpRendererImpl ):public CBase, |
|
56 public MGlxActiveMediaListChangeObserver, |
|
57 public MGlxMediaListObserver, |
|
58 public MUpnpCommandObserver, |
|
59 public MGlxThumbnailSaveComplete |
|
60 { |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * |
|
66 * @return Pointer |
|
67 */ |
|
68 static CGlxUpnpRendererImpl* NewL(); |
|
69 |
|
70 /** |
|
71 * Destructor |
|
72 */ |
|
73 ~CGlxUpnpRendererImpl(); |
|
74 |
|
75 private: |
|
76 |
|
77 /** |
|
78 * Symbian 2nd phase constructor |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 /** |
|
83 * Default Constructor |
|
84 */ |
|
85 CGlxUpnpRendererImpl(); |
|
86 |
|
87 public: |
|
88 |
|
89 /** |
|
90 * Show the video file on the UPnP device |
|
91 */ |
|
92 void UpnpShowVideoL(); |
|
93 |
|
94 /** |
|
95 * Access point is set or not |
|
96 * @return ETrue access point is defined |
|
97 */ |
|
98 static TBool IsSupported(); |
|
99 |
|
100 /** |
|
101 * Error Status when Show Image/Video |
|
102 * @return TErrorStatus - UPnP Status |
|
103 */ |
|
104 NGlxUpnpRenderer::TErrorStatus UpnpErrorStatus(); |
|
105 //From MGLxMediaListObserver |
|
106 |
|
107 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex,MGlxMediaList* aList); |
|
108 |
|
109 |
|
110 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
111 |
|
112 |
|
113 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex,MGlxMediaList* aList); |
|
114 |
|
115 |
|
116 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList) ; |
|
117 |
|
118 |
|
119 void HandleAttributesAvailableL(TInt aItemIndex,const RArray<TMPXAttribute>& aAttributes, |
|
120 MGlxMediaList* aList); |
|
121 |
|
122 |
|
123 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, |
|
124 MGlxMediaList* aList); |
|
125 |
|
126 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
127 |
|
128 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
129 |
|
130 void HandleError(TInt aError) { (void)aError; }; |
|
131 |
|
132 //From MGlxActiveMediaListChangeObserver |
|
133 |
|
134 void HandleActiveMediaListChanged(); |
|
135 |
|
136 //From MUpnpCommandObserver |
|
137 |
|
138 void CommandComplete( TInt aStatusCode ); |
|
139 |
|
140 //MGlxThumbnailSaveComplete |
|
141 |
|
142 void HandleFileSaveCompleteL(const TDesC& aPath); |
|
143 |
|
144 // Callback function |
|
145 static TInt DoFocusChanged( TAny* aPtr ); |
|
146 |
|
147 private: |
|
148 /** |
|
149 * Creates the contextfor the medailist |
|
150 * @return none |
|
151 */ |
|
152 void CreateContextL(); |
|
153 |
|
154 /** |
|
155 * Access the active media list of the view |
|
156 */ |
|
157 void PrepareMediaListL(); |
|
158 |
|
159 /** |
|
160 * Access the active media list of the view |
|
161 */ |
|
162 void SendFocusedItemL(TInt aNewIndex); |
|
163 |
|
164 /** |
|
165 * Access the active media list of the view |
|
166 */ |
|
167 void SendFocusedItemL(TInt aNewIndex,const RArray<TMPXAttribute>& aAttributes); |
|
168 |
|
169 /** |
|
170 * Get the image attribute |
|
171 */ |
|
172 void GetImageL(const TGlxMedia& aMedia); |
|
173 |
|
174 /** |
|
175 * Get the video attribute |
|
176 */ |
|
177 void GetVideoL(const TGlxMedia& aMedia,TMPXAttribute& aAttrThumbnail); |
|
178 |
|
179 /** |
|
180 * Show Command has been completed. |
|
181 */ |
|
182 void CommandCompleteL( TInt aStatusCode ); |
|
183 |
|
184 /** |
|
185 * Display the Image after the Video play is Complete |
|
186 */ |
|
187 void ShowImageAfterVideoL(); |
|
188 |
|
189 /** |
|
190 * Used by the callback function to provide asynchronous focus change |
|
191 */ |
|
192 void DoFocusChangedL(); |
|
193 |
|
194 private: |
|
195 |
|
196 ///used to resolve the medialist from the views |
|
197 MGlxActiveMediaListResolver* iActiveMediaListResolver; |
|
198 |
|
199 ///activemedialist obj , ref from the tile or full screen view |
|
200 MGlxMediaList* iActiveMediaList; |
|
201 |
|
202 /// attribute context (owned) |
|
203 ///@ used for retrieving the uri attribute of the focused item(image/video) |
|
204 CGlxDefaultAttributeContext* iAttributeContext; |
|
205 |
|
206 ///upnpshow command |
|
207 ///@owns CGlxUpnpRendererImpl |
|
208 CUpnpShowCommand* iUpnpShowCommand; |
|
209 |
|
210 //Check the previouusly focussed item |
|
211 TGlxMediaId iPreviouslySentMediaId; |
|
212 |
|
213 ///thumbnail context (owned) |
|
214 /// used for retrieving the thumbnail of the focused video from the tile views |
|
215 CGlxDefaultThumbnailContext* iThumbnailContext; |
|
216 |
|
217 ///Thumbnail saver class object(owned) |
|
218 ///@ used for saving the blited thumbnail image |
|
219 CGlxThumbnailSaver* iThumbnailSaver; |
|
220 ///Flag to decide if video is to be shown on the rendering device |
|
221 //TRUE implies video is being shown on UPnP |
|
222 //FALSE implies image is being shown on UPnP |
|
223 TBool iIsVideoShow; |
|
224 |
|
225 //Store the path of the thumbnail video icon |
|
226 TBuf<35> iVideoThumbnail; |
|
227 //The UPnP Error Status when show is complete |
|
228 NGlxUpnpRenderer::TErrorStatus iUpnpErrorStatus; |
|
229 |
|
230 // Handle a change in focus asynchronously, owned |
|
231 CAsyncCallBack* iHandleFocusChangeCallback; |
|
232 public: |
|
233 //flag to check if upnp is supported |
|
234 TBool iUpnpSupported; |
|
235 }; |
|
236 |
|
237 #endif |