Platinum UPnP SDK  1.0.5.13
PltMediaItem.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - AV Media Item
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
21 |
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
32 |
33 ****************************************************************/
34 
39 #ifndef _PLT_MEDIA_ITEM_H_
40 #define _PLT_MEDIA_ITEM_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 #include "PltHttp.h"
47 #include "PltProtocolInfo.h"
48 
49 /*----------------------------------------------------------------------
50 | typedefs
51 +---------------------------------------------------------------------*/
55 typedef struct {
56  NPT_String type;
57  NPT_String friendly_name;
59 
60 typedef struct {
61  NPT_String type;
62  NPT_String friendly_name;
63  bool include_derived;
64 } PLT_SearchClass;
65 
66 typedef struct {
67  NPT_String name;
68  NPT_String role;
69 } PLT_PersonRole;
70 
71 class PLT_PersonRoles : public NPT_List<PLT_PersonRole>
72 {
73 public:
74  NPT_Result Add(const NPT_String& name, const NPT_String& role = "");
75  NPT_Result ToDidl(NPT_String& didl, const NPT_String& tag);
76  NPT_Result FromDidl(const NPT_Array<NPT_XmlElementNode*>& nodes);
77 };
78 
79 typedef struct {
80  NPT_String allowed_use; // (CSV)
81  NPT_String validity_start;
82  NPT_String validity_end;
83  NPT_String remaining_time;
84  NPT_String usage_info;
85  NPT_String rights_info_uri;
86  NPT_String content_info_uri;
87 } PLT_Constraint;
88 
89 typedef struct {
90  PLT_PersonRoles artists;
91  PLT_PersonRoles actors;
92  PLT_PersonRoles authors;
93  NPT_String producer; //TODO: can be multiple
94  NPT_String director; //TODO: can be multiple
95  NPT_String publisher; //TODO: can be multiple
96  NPT_String contributor; // should match m_Creator (dc:creator) //TODO: can be multiple
97 } PLT_PeopleInfo;
98 
99 typedef struct {
100  NPT_List<NPT_String> genres;
101  NPT_String album; //TODO: can be multiple
102  NPT_String playlist; // dc:title of the playlist item the content belongs too //TODO: can be multiple
103 } PLT_AffiliationInfo;
104 
105 typedef struct {
106  NPT_String description;
107  NPT_String long_description;
108  NPT_String icon_uri;
109  NPT_String region;
110  NPT_String rating;
111  NPT_String rights; //TODO: can be multiple
112  NPT_String date;
113  NPT_String language;
114 } PLT_Description;
115 
116 typedef struct {
117  NPT_String uri;
118  NPT_String dlna_profile;
119 } PLT_AlbumArtInfo;
120 
121 typedef struct {
122  NPT_List<PLT_AlbumArtInfo> album_arts;
123  NPT_String artist_discography_uri;
124  NPT_String lyrics_uri;
125  NPT_List<NPT_String> relations; // dc:relation
126 } PLT_ExtraInfo;
127 
128 typedef struct {
129  NPT_UInt32 dvdregioncode;
130  NPT_UInt32 original_track_number;
131  NPT_String toc;
132  NPT_String user_annotation; //TODO: can be multiple
133 } PLT_MiscInfo;
134 
135 typedef struct {
136  NPT_UInt64 total;
137  NPT_UInt64 used;
138  NPT_UInt64 free;
139  NPT_UInt64 max_partition;
140  NPT_UInt64 medium;
141 } PLT_StorageInfo;
142 
143 typedef struct {
144  NPT_String program_title;
145  NPT_String series_title;
146  NPT_UInt32 episode_number;
147 } PLT_RecordedInfo;
148 
149 /*----------------------------------------------------------------------
150 | PLT_MediaItemResource
151 +---------------------------------------------------------------------*/
152 class PLT_MediaItemResource
153 {
154 public:
155  PLT_MediaItemResource();
156  ~PLT_MediaItemResource() {}
157 
158  NPT_String m_Uri;
159  PLT_ProtocolInfo m_ProtocolInfo;
160  NPT_UInt32 m_Duration; /* seconds */
161  NPT_LargeSize m_Size;
162  NPT_String m_Protection;
163  NPT_UInt32 m_Bitrate; /* bytes/seconds */
164  NPT_UInt32 m_BitsPerSample;
165  NPT_UInt32 m_SampleFrequency;
166  NPT_UInt32 m_NbAudioChannels;
167  NPT_String m_Resolution;
168  NPT_UInt32 m_ColorDepth;
169 };
170 
171 /*----------------------------------------------------------------------
172 | PLT_MediaObject
173 +---------------------------------------------------------------------*/
180 {
181 protected:
182  NPT_IMPLEMENT_DYNAMIC_CAST(PLT_MediaObject)
183 
184  PLT_MediaObject() : m_Restricted(true) {}
185 
186 public:
187  virtual ~PLT_MediaObject() {}
188 
189  bool IsContainer() { return m_ObjectClass.type.StartsWith("object.container"); }
190 
191  static const char* GetUPnPClass(const char* filename,
192  const PLT_HttpRequestContext* context = NULL);
193 
194  virtual NPT_Result Reset();
195  virtual NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl);
196  virtual NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
197  virtual NPT_Result FromDidl(NPT_XmlElementNode* entry);
198 
199 public:
200  /* common properties */
201  PLT_ObjectClass m_ObjectClass;
202  NPT_String m_ObjectID;
203  NPT_String m_ParentID;
204  NPT_String m_ReferenceID;
205 
206  /* metadata */
207  NPT_String m_Title;
208  NPT_String m_Creator;
209  NPT_String m_Date;
210  PLT_PeopleInfo m_People;
211  PLT_AffiliationInfo m_Affiliation;
212  PLT_Description m_Description;
213  PLT_RecordedInfo m_Recorded;
214 
215  /* properties */
216  bool m_Restricted;
217 
218  /* extras */
219  PLT_ExtraInfo m_ExtraInfo;
220 
221  /* miscellaneous info */
222  PLT_MiscInfo m_MiscInfo;
223 
224  /* resources related */
225  NPT_Array<PLT_MediaItemResource> m_Resources;
226 
227  /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
228  NPT_String m_Didl;
229 };
230 
231 /*----------------------------------------------------------------------
232 | PLT_MediaItem
233 +---------------------------------------------------------------------*/
239 {
240 public:
241  NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaItem, PLT_MediaObject)
242 
243  PLT_MediaItem();
244  virtual ~PLT_MediaItem();
245 
246  // PLT_MediaObject methods
247  NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl);
248  NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
249  NPT_Result FromDidl(NPT_XmlElementNode* entry);
250 };
251 
252 /*----------------------------------------------------------------------
253 | PLT_MediaContainer
254 +---------------------------------------------------------------------*/
261 {
262 public:
263  NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaContainer, PLT_MediaObject)
264 
266  virtual ~PLT_MediaContainer();
267 
268  // PLT_MediaObject methods
269  NPT_Result Reset();
270  NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl);
271  NPT_Result ToDidl(NPT_UInt32 mask, NPT_String& didl);
272  NPT_Result FromDidl(NPT_XmlElementNode* entry);
273 
274 public:
275  NPT_List<PLT_SearchClass> m_SearchClasses;
276 
277  /* properties */
278  bool m_Searchable;
279 
280  /* container info related */
281  NPT_Int32 m_ChildrenCount;
282  NPT_UInt32 m_ContainerUpdateID;
283 };
284 
285 /*----------------------------------------------------------------------
286 | PLT_MediaObjectList
287 +---------------------------------------------------------------------*/
291 class PLT_MediaObjectList : public NPT_List<PLT_MediaObject*>
292 {
293 public:
295 
296 protected:
297  virtual ~PLT_MediaObjectList(void);
298  friend class NPT_Reference<PLT_MediaObjectList>;
299 };
300 
301 typedef NPT_Reference<PLT_MediaObjectList> PLT_MediaObjectListReference;
302 typedef NPT_Reference<PLT_MediaObject> PLT_MediaObjectReference;
303 
304 #endif /* _PLT_MEDIA_ITEM_H_ */
The PLT_ProtocolInfo class holds information about the protocol info of a given UPnP Media Item resou...
Definition: PltProtocolInfo.h:68
The PLT_MediaItem class represents a first-level class derived directly from PLT_MediaObject.
Definition: PltMediaItem.h:238
The PLT_MediaObjectList class is a list of PLT_MediaObject instances.
Definition: PltMediaItem.h:291
The PLT_MediaContainer class represents a first-level class derived directly from PLT_MediaObject...
Definition: PltMediaItem.h:260
The PLT_HttpRequestContext class holds information about the request sent, the local & remote ip addr...
Definition: PltHttp.h:115
The PLT_ObjectClass struct is used to assign a type to a PLT_MediaObject.
Definition: PltMediaItem.h:55
The PLT_MediaObject class is any data entity that can be returned by a ContentDirectory Service from ...
Definition: PltMediaItem.h:179
UPnP AV Media Object Protocol Info.
HTTP utilities.