1 /*****************************************************************
3 | Platinum - AV Media Item
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
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 ****************************************************************/
36 UPnP AV Media Object reprensentation.
39 #ifndef _PLT_MEDIA_ITEM_H_
40 #define _PLT_MEDIA_ITEM_H_
42 /*----------------------------------------------------------------------
44 +---------------------------------------------------------------------*/
47 #include "PltProtocolInfo.h"
49 /*----------------------------------------------------------------------
51 +---------------------------------------------------------------------*/
53 The PLT_ObjectClass struct is used to assign a type to a PLT_MediaObject.
57 NPT_String friendly_name
;
62 NPT_String friendly_name
;
71 class PLT_PersonRoles
: public NPT_List
<PLT_PersonRole
>
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
);
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
;
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
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
;
106 NPT_String description
;
107 NPT_String long_description
;
111 NPT_String rights
; //TODO: can be multiple
118 NPT_String dlna_profile
;
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
129 NPT_UInt32 dvdregioncode
;
130 NPT_UInt32 original_track_number
;
132 NPT_String user_annotation
; //TODO: can be multiple
133 NPT_UInt32 last_position
;
134 NPT_String last_time
;
135 NPT_Int32 play_count
;
142 NPT_UInt64 max_partition
;
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
;
159 class PLT_Artworks
: public NPT_List
<PLT_Artwork
>
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
);
168 NPT_String last_playerstate
;
169 NPT_String date_added
;
172 PLT_Artworks artwork
;
173 NPT_String unique_identifier
;
174 NPT_List
<NPT_String
> countries
;
175 NPT_Int32 user_rating
;
180 NPT_Map
<NPT_String
, NPT_String
> attributes
;
184 /*----------------------------------------------------------------------
185 | PLT_MediaItemResource
186 +---------------------------------------------------------------------*/
187 class PLT_MediaItemResource
190 PLT_MediaItemResource();
191 ~PLT_MediaItemResource() {}
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 /*----------------------------------------------------------------------
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
220 NPT_IMPLEMENT_DYNAMIC_CAST(PLT_MediaObject
)
222 PLT_MediaObject() : m_Restricted(true) {}
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
);
238 /* common properties */
239 PLT_ObjectClass m_ObjectClass
;
240 NPT_String m_ObjectID
;
241 NPT_String m_ParentID
;
242 NPT_String m_ReferenceID
;
246 NPT_String m_Creator
;
248 PLT_PeopleInfo m_People
;
249 PLT_AffiliationInfo m_Affiliation
;
250 PLT_Description m_Description
;
251 PLT_RecordedInfo m_Recorded
;
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
;
269 PLT_XbmcInfo m_XbmcInfo
;
271 /* original DIDL for Control Points to pass to a renderer when invoking SetAVTransportURI */
275 /*----------------------------------------------------------------------
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
285 NPT_IMPLEMENT_DYNAMIC_CAST_D(PLT_MediaItem
, PLT_MediaObject
)
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 /*----------------------------------------------------------------------
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
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
;
319 NPT_List
<PLT_SearchClass
> m_SearchClasses
;
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
*>
338 PLT_MediaObjectList();
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_ */