Merge pull request #25959 from neo1973/TagLib_deprecation_warnings
[xbmc.git] / lib / libUPnP / Platinum / Source / Devices / MediaServer / PltMediaItem.h
blob3a13967f5f9bde226de8333cbd94bbd2cdc9cac0
1 /*****************************************************************
3 | Platinum - AV Media Item
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
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.
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
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.
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
33 ****************************************************************/
35 /** @file
36 UPnP AV Media Object reprensentation.
39 #ifndef _PLT_MEDIA_ITEM_H_
40 #define _PLT_MEDIA_ITEM_H_
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 #include "PltHttp.h"
47 #include "PltProtocolInfo.h"
49 /*----------------------------------------------------------------------
50 | typedefs
51 +---------------------------------------------------------------------*/
52 /**
53 The PLT_ObjectClass struct is used to assign a type to a PLT_MediaObject.
55 typedef struct {
56 NPT_String type;
57 NPT_String friendly_name;
58 } PLT_ObjectClass;
60 typedef struct {
61 NPT_String type;
62 NPT_String friendly_name;
63 bool include_derived;
64 } PLT_SearchClass;
66 typedef struct {
67 NPT_String name;
68 NPT_String role;
69 } PLT_PersonRole;
71 class PLT_PersonRoles : public NPT_List<PLT_PersonRole>
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);
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;
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
97 } PLT_PeopleInfo;
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;
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;
116 typedef struct {
117 NPT_String uri;
118 NPT_String dlna_profile;
119 } PLT_AlbumArtInfo;
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;
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;
138 typedef struct {
139 NPT_UInt64 total;
140 NPT_UInt64 used;
141 NPT_UInt64 free;
142 NPT_UInt64 max_partition;
143 NPT_UInt64 medium;
144 } PLT_StorageInfo;
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;
152 } PLT_RecordedInfo;
154 typedef struct {
155 NPT_String type;
156 NPT_String url;
157 } PLT_Artwork;
159 class PLT_Artworks : public NPT_List<PLT_Artwork>
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);
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;
178 typedef struct {
179 NPT_String name;
180 NPT_Map<NPT_String, NPT_String> attributes;
181 NPT_String value;
182 } PLT_SecResource;
184 /*----------------------------------------------------------------------
185 | PLT_MediaItemResource
186 +---------------------------------------------------------------------*/
187 class PLT_MediaItemResource
189 public:
190 PLT_MediaItemResource();
191 ~PLT_MediaItemResource() {}
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;
209 /*----------------------------------------------------------------------
210 | PLT_MediaObject
211 +---------------------------------------------------------------------*/
213 The PLT_MediaObject class is any data entity that can be returned by a
214 ContentDirectory Service from a browsing or searching action. This is the
215 base class from which PLT_MediaItem and PLT_MediaContainer derive.
217 class PLT_MediaObject
219 protected:
220 NPT_IMPLEMENT_DYNAMIC_CAST(PLT_MediaObject)
222 PLT_MediaObject() : m_Restricted(true) {}
224 public:
225 virtual ~PLT_MediaObject() {}
227 bool IsContainer() { return m_ObjectClass.type.StartsWith("object.container"); }
229 static const char* GetUPnPClass(const char* filename,
230 const PLT_HttpRequestContext* context = NULL);
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);
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;
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;
253 /* properties */
254 bool m_Restricted;
256 /* extras */
257 PLT_ExtraInfo m_ExtraInfo;
259 /* miscellaneous info */
260 PLT_MiscInfo m_MiscInfo;
262 /* resources related */
263 NPT_Array<PLT_MediaItemResource> m_Resources;
265 /* sec resources related */
266 NPT_Array<PLT_SecResource> m_SecResources;
268 /* XBMC specific */
269 PLT_XbmcInfo m_XbmcInfo;
271 /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
272 NPT_String m_Didl;
275 /*----------------------------------------------------------------------
276 | PLT_MediaItem
277 +---------------------------------------------------------------------*/
279 The PLT_MediaItem class represents a first-level class derived directly from
280 PLT_MediaObject. It most often represents a single piece of AV data.
282 class PLT_MediaItem : public PLT_MediaObject
284 public:
285 NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaItem, PLT_MediaObject)
287 PLT_MediaItem();
288 ~PLT_MediaItem() override;
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;
296 /*----------------------------------------------------------------------
297 | PLT_MediaContainer
298 +---------------------------------------------------------------------*/
300 The PLT_MediaContainer class represents a first-level class derived directly
301 from PLT_MediaObject. A PLT_MediaContainer represents a collection of
302 PLT_MediaObject instances.
304 class PLT_MediaContainer : public PLT_MediaObject
306 public:
307 NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaContainer, PLT_MediaObject)
309 PLT_MediaContainer();
310 ~PLT_MediaContainer() override;
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;
318 public:
319 NPT_List<PLT_SearchClass> m_SearchClasses;
321 /* properties */
322 bool m_Searchable;
324 /* container info related */
325 NPT_Int32 m_ChildrenCount;
326 NPT_UInt32 m_ContainerUpdateID;
329 /*----------------------------------------------------------------------
330 | PLT_MediaObjectList
331 +---------------------------------------------------------------------*/
333 The PLT_MediaObjectList class is a list of PLT_MediaObject instances.
335 class PLT_MediaObjectList : public NPT_List<PLT_MediaObject*>
337 public:
338 PLT_MediaObjectList();
340 protected:
341 virtual ~PLT_MediaObjectList(void);
342 friend class NPT_Reference<PLT_MediaObjectList>;
345 typedef NPT_Reference<PLT_MediaObjectList> PLT_MediaObjectListReference;
346 typedef NPT_Reference<PLT_MediaObject> PLT_MediaObjectReference;
348 #endif /* _PLT_MEDIA_ITEM_H_ */