|
1 /* |
|
2 * Copyright (c) 2007 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: Fills MPX playlist by browsing media server content |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 // upnpframework / xmlparser api |
|
21 #include "upnpobjectlite.h" |
|
22 |
|
23 // musicadapter internal |
|
24 #include "upnpliteselectionfiller.h" |
|
25 |
|
26 // debug |
|
27 _LIT16( KComponentLogfile, "musicadapter.txt" ); |
|
28 #include "upnplog.h" |
|
29 |
|
30 // CONSTANTS |
|
31 const TInt KItemListGranularity = 20; |
|
32 |
|
33 // METHODS |
|
34 |
|
35 // -------------------------------------------------------------------------- |
|
36 // CUPnPLiteSelectionFiller::NewL |
|
37 //--------------------------------------------------------------------------- |
|
38 EXPORT_C CUPnPLiteSelectionFiller* CUPnPLiteSelectionFiller::NewL( |
|
39 const RPointerArray<CUpnpObjectLite>& aObjectList, |
|
40 const CUpnpAVDevice& aMediaServer ) |
|
41 { |
|
42 CUPnPLiteSelectionFiller* filler = |
|
43 new(ELeave)CUPnPLiteSelectionFiller(); |
|
44 CleanupStack::PushL( filler ); |
|
45 filler->ConstructL( aObjectList, aMediaServer ); |
|
46 CleanupStack::Pop( filler ); |
|
47 return filler; |
|
48 } |
|
49 |
|
50 // -------------------------------------------------------------------------- |
|
51 // CUPnPLiteSelectionFiller::FillL |
|
52 // Fill track data into the playlist |
|
53 // -------------------------------------------------------------------------- |
|
54 // |
|
55 void CUPnPLiteSelectionFiller::FillL( |
|
56 CUPnPMusicAdapter& aHost, |
|
57 CMPXMediaArray& aPlaylist ) |
|
58 { |
|
59 __LOG( "CUPnPLiteSelectionFiller::FillL" ); |
|
60 SetHost( aHost ); |
|
61 |
|
62 TInt count = iObjectList.Count(); |
|
63 for( TInt i = 0; i < count; i++ ) |
|
64 { |
|
65 // Convert to mpx media and add to the playlist. |
|
66 FillItemMpxPlaylistL( aPlaylist, *iObjectList[i], 0 ); |
|
67 } |
|
68 |
|
69 DoComplete(); |
|
70 __LOG( "CUPnPLiteSelectionFiller::FillL - End" ); |
|
71 } |
|
72 |
|
73 // -------------------------------------------------------------------------- |
|
74 // CUPnPLiteSelectionFiller::CancelFill |
|
75 // -------------------------------------------------------------------------- |
|
76 // |
|
77 void CUPnPLiteSelectionFiller::CancelFill() |
|
78 { |
|
79 // no implementation required |
|
80 // - this class does not have async nature |
|
81 } |
|
82 |
|
83 // -------------------------------------------------------------------------- |
|
84 // CUPnPLiteSelectionFiller::PlaylistSize |
|
85 // Returns the total playlist size |
|
86 // -------------------------------------------------------------------------- |
|
87 // |
|
88 TInt CUPnPLiteSelectionFiller::PlaylistSize() |
|
89 { |
|
90 return iObjectList.Count(); |
|
91 } |
|
92 |
|
93 // -------------------------------------------------------------------------- |
|
94 // CUPnPLiteSelectionFiller::~CUPnPLiteSelectionFiller |
|
95 //--------------------------------------------------------------------------- |
|
96 EXPORT_C CUPnPLiteSelectionFiller::~CUPnPLiteSelectionFiller() |
|
97 { |
|
98 iObjectList.Reset(); |
|
99 } |
|
100 |
|
101 // -------------------------------------------------------------------------- |
|
102 // CUPnPLiteSelectionFiller::CUPnPLiteSelectionFiller |
|
103 // 1st phase constructor. |
|
104 // -------------------------------------------------------------------------- |
|
105 // |
|
106 CUPnPLiteSelectionFiller::CUPnPLiteSelectionFiller() |
|
107 : iObjectList( KItemListGranularity ) |
|
108 { |
|
109 } |
|
110 |
|
111 // -------------------------------------------------------------------------- |
|
112 // CUPnPLiteSelectionFiller::ConstructL |
|
113 // 2nd phase constructor. |
|
114 // -------------------------------------------------------------------------- |
|
115 // |
|
116 void CUPnPLiteSelectionFiller::ConstructL( |
|
117 const RPointerArray<CUpnpObjectLite>& aObjectList, |
|
118 const CUpnpAVDevice& aMediaServer ) |
|
119 { |
|
120 __LOG( "CUPnPLiteSelectionFiller::ConstructL" ); |
|
121 |
|
122 // Set object list |
|
123 TInt count = aObjectList.Count(); |
|
124 for( TInt i = 0; i < count; i++ ) |
|
125 { |
|
126 iObjectList.AppendL( aObjectList[i] ); |
|
127 } |
|
128 |
|
129 // Set device uid |
|
130 SetSourceDeviceL( aMediaServer ); |
|
131 } |
|
132 |
|
133 |