xbmc
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;
65 
66 typedef struct {
67  NPT_String name;
68  NPT_String role;
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;
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  PLT_PersonRoles directors;
95  NPT_List<NPT_String> publisher;
96  NPT_String contributor; // should match m_Creator (dc:creator) //TODO: can be multiple
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
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;
115 
116 typedef struct {
117  NPT_String uri;
118  NPT_String dlna_profile;
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  NPT_UInt32 last_position;
134  NPT_String last_time;
135  NPT_Int32 play_count;
136 } PLT_MiscInfo;
137 
138 typedef struct {
139  NPT_UInt64 total;
140  NPT_UInt64 used;
141  NPT_UInt64 free;
142  NPT_UInt64 max_partition;
143  NPT_UInt64 medium;
145 
146 typedef struct {
147  NPT_String program_title;
148  NPT_String series_title;
149  NPT_UInt32 episode_number;
150  NPT_UInt32 episode_count;
151  NPT_UInt32 episode_season;
153 
154 typedef struct {
155  NPT_String type;
156  NPT_String url;
157 } PLT_Artwork;
158 
159 class PLT_Artworks : public NPT_List<PLT_Artwork>
160 {
161 public:
162  NPT_Result Add(const NPT_String& type, const NPT_String& url);
163  NPT_Result ToDidl(NPT_String& didl, const NPT_String& tag);
164  NPT_Result FromDidl(const NPT_Array<NPT_XmlElementNode*>& nodes);
165 };
166 
167 typedef struct {
168  NPT_String last_playerstate;
169  NPT_String date_added;
170  NPT_Float rating;
171  NPT_Int32 votes;
172  PLT_Artworks artwork;
173  NPT_String unique_identifier;
174  NPT_List<NPT_String> countries;
175  NPT_Int32 user_rating;
176 } PLT_XbmcInfo;
177 
178 typedef struct {
179  NPT_String name;
181  NPT_String value;
183 
184 /*----------------------------------------------------------------------
185 | PLT_MediaItemResource
186 +---------------------------------------------------------------------*/
188 {
189 public:
192 
193  NPT_String m_Uri;
194  PLT_ProtocolInfo m_ProtocolInfo;
195  NPT_UInt32 m_Duration; /* seconds */
196  NPT_LargeSize m_Size;
197  NPT_String m_Protection;
198  NPT_UInt32 m_Bitrate; /* bytes/seconds */
199  NPT_UInt32 m_BitsPerSample;
200  NPT_UInt32 m_SampleFrequency;
201  NPT_UInt32 m_NbAudioChannels;
202  NPT_String m_Resolution;
203  NPT_UInt32 m_ColorDepth;
204  /* to add custom data to resource, that are not standard one, or are only
205  proper for some type of devices (UPnP)*/
206  NPT_Map<NPT_String, NPT_String> m_CustomData;
207 };
208 
209 /*----------------------------------------------------------------------
210 | PLT_MediaObject
211 +---------------------------------------------------------------------*/
218 {
219 protected:
220  NPT_IMPLEMENT_DYNAMIC_CAST(PLT_MediaObject)
221 
222  PLT_MediaObject() : m_Restricted(true) {}
223 
224 public:
225  virtual ~PLT_MediaObject() {}
226 
227  bool IsContainer() { return m_ObjectClass.type.StartsWith("object.container"); }
228 
229  static const char* GetUPnPClass(const char* filename,
230  const PLT_HttpRequestContext* context = NULL);
231 
232  virtual NPT_Result Reset();
233  virtual NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl);
234  virtual NPT_Result ToDidl(NPT_UInt64 mask, NPT_String& didl);
235  virtual NPT_Result FromDidl(NPT_XmlElementNode* entry);
236 
237 public:
238  /* common properties */
239  PLT_ObjectClass m_ObjectClass;
240  NPT_String m_ObjectID;
241  NPT_String m_ParentID;
242  NPT_String m_ReferenceID;
243 
244  /* metadata */
245  NPT_String m_Title;
246  NPT_String m_Creator;
247  NPT_String m_Date;
248  PLT_PeopleInfo m_People;
249  PLT_AffiliationInfo m_Affiliation;
250  PLT_Description m_Description;
251  PLT_RecordedInfo m_Recorded;
252 
253  /* properties */
254  bool m_Restricted;
255 
256  /* extras */
257  PLT_ExtraInfo m_ExtraInfo;
258 
259  /* miscellaneous info */
260  PLT_MiscInfo m_MiscInfo;
261 
262  /* resources related */
264 
265  /* sec resources related */
266  NPT_Array<PLT_SecResource> m_SecResources;
267 
268  /* XBMC specific */
269  PLT_XbmcInfo m_XbmcInfo;
270 
271  /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
272  NPT_String m_Didl;
273 };
274 
275 /*----------------------------------------------------------------------
276 | PLT_MediaItem
277 +---------------------------------------------------------------------*/
283 {
284 public:
285  NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaItem, PLT_MediaObject)
286 
287  PLT_MediaItem();
288  ~PLT_MediaItem() override;
289 
290  // PLT_MediaObject methods
291  NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl) override;
292  NPT_Result ToDidl(NPT_UInt64 mask, NPT_String& didl) override;
293  NPT_Result FromDidl(NPT_XmlElementNode* entry) override;
294 };
295 
296 /*----------------------------------------------------------------------
297 | PLT_MediaContainer
298 +---------------------------------------------------------------------*/
305 {
306 public:
307  NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaContainer, PLT_MediaObject)
308 
310  ~PLT_MediaContainer() override;
311 
312  // PLT_MediaObject methods
313  NPT_Result Reset() override;
314  NPT_Result ToDidl(const NPT_String& filter, NPT_String& didl) override;
315  NPT_Result ToDidl(NPT_UInt64 mask, NPT_String& didl) override;
316  NPT_Result FromDidl(NPT_XmlElementNode* entry) override;
317 
318 public:
319  NPT_List<PLT_SearchClass> m_SearchClasses;
320 
321  /* properties */
322  bool m_Searchable;
323 
324  /* container info related */
325  NPT_Int32 m_ChildrenCount;
326  NPT_UInt32 m_ContainerUpdateID;
327 };
328 
329 /*----------------------------------------------------------------------
330 | PLT_MediaObjectList
331 +---------------------------------------------------------------------*/
335 class PLT_MediaObjectList : public NPT_List<PLT_MediaObject*>
336 {
337 public:
339 
340 protected:
341  virtual ~PLT_MediaObjectList(void);
342  friend class NPT_Reference<PLT_MediaObjectList>;
343 };
344 
347 
348 #endif /* _PLT_MEDIA_ITEM_H_ */
Definition: NptXml.h:172
Definition: PltMediaItem.h:178
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:282
Definition: PltMediaItem.h:138
Definition: PltMediaItem.h:99
Definition: NptArray.h:54
The PLT_MediaObjectList class is a list of PLT_MediaObject instances.
Definition: PltMediaItem.h:335
Definition: PltMediaItem.h:89
Definition: PltMediaItem.h:146
Definition: PltMediaItem.h:128
Definition: PltMediaItem.h:121
The PLT_MediaContainer class represents a first-level class derived directly from PLT_MediaObject...
Definition: PltMediaItem.h:304
Definition: PltMediaItem.h:187
Definition: PltMediaItem.h:159
Definition: PltMediaItem.h:79
The PLT_HttpRequestContext class holds information about the request sent, the local & remote ip addr...
Definition: PltHttp.h:111
Definition: PltMediaItem.h:60
Definition: PltMediaItem.h:71
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:217
Definition: PltMediaItem.h:66
UPnP AV Media Object Protocol Info.
Definition: PltMediaItem.h:154
Definition: NptReferences.h:45
Definition: PltMediaItem.h:167
Definition: NptStrings.h:57
Definition: PltMediaItem.h:105
Definition: NptList.h:54
Definition: PltMediaItem.h:116
HTTP utilities.