Platinum UPnP SDK  1.0.5.13
PltDidl.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - DIDL handling
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_DIDL_H_
40 #define _PLT_DIDL_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 #include "PltMediaItem.h"
47 
48 /*----------------------------------------------------------------------
49 | constants
50 +---------------------------------------------------------------------*/
51 #define PLT_FILTER_MASK_ALL 0xFFFFFFFF
52 
53 #define PLT_FILTER_MASK_CREATOR 0x00000001
54 #define PLT_FILTER_MASK_ARTIST 0x00000002
55 #define PLT_FILTER_MASK_ALBUM 0x00000004
56 #define PLT_FILTER_MASK_GENRE 0x00000008
57 #define PLT_FILTER_MASK_ALBUMARTURI 0x00000010
58 #define PLT_FILTER_MASK_DESCRIPTION 0x00000020
59 #define PLT_FILTER_MASK_SEARCHABLE 0x00000040
60 #define PLT_FILTER_MASK_CHILDCOUNT 0x00000080
61 #define PLT_FILTER_MASK_ORIGINALTRACK 0x00000100
62 #define PLT_FILTER_MASK_ACTOR 0x00000200
63 #define PLT_FILTER_MASK_AUTHOR 0x00000400
64 #define PLT_FILTER_MASK_DATE 0x00000800
65 #define PLT_FILTER_MASK_PROGRAMTITLE 0x00001000
66 #define PLT_FILTER_MASK_SERIESTITLE 0x00002000
67 #define PLT_FILTER_MASK_EPISODE 0x00004000
68 #define PLT_FILTER_MASK_TITLE 0x00008000
69 
70 #define PLT_FILTER_MASK_RES 0x00010000
71 #define PLT_FILTER_MASK_RES_DURATION 0x00020000
72 #define PLT_FILTER_MASK_RES_SIZE 0x00040000
73 #define PLT_FILTER_MASK_RES_PROTECTION 0x00080000
74 #define PLT_FILTER_MASK_RES_RESOLUTION 0x00100000
75 #define PLT_FILTER_MASK_RES_BITRATE 0x00200000
76 #define PLT_FILTER_MASK_RES_BITSPERSAMPLE 0x00400000
77 #define PLT_FILTER_MASK_RES_NRAUDIOCHANNELS 0x00800000
78 #define PLT_FILTER_MASK_RES_SAMPLEFREQUENCY 0x01000000
79 
80 #define PLT_FILTER_MASK_LONGDESCRIPTION 0x02000000
81 #define PLT_FILTER_MASK_ICON 0x04000000
82 
83 #define PLT_FILTER_MASK_TOC 0x02000000
84 #define PLT_FILTER_MASK_SEARCHCLASS 0x04000000
85 #define PLT_FILTER_MASK_REFID 0x08000000
86 
87 #define PLT_FILTER_FIELD_TITLE "dc:title"
88 #define PLT_FILTER_FIELD_CREATOR "dc:creator"
89 #define PLT_FILTER_FIELD_DATE "dc:date"
90 #define PLT_FILTER_FIELD_ARTIST "upnp:artist"
91 #define PLT_FILTER_FIELD_ACTOR "upnp:actor"
92 #define PLT_FILTER_FIELD_AUTHOR "upnp:author"
93 #define PLT_FILTER_FIELD_ALBUM "upnp:album"
94 #define PLT_FILTER_FIELD_GENRE "upnp:genre"
95 #define PLT_FILTER_FIELD_ALBUMARTURI "upnp:albumArtURI"
96 #define PLT_FILTER_FIELD_ALBUMARTURI_DLNAPROFILEID "upnp:albumArtURI@dlna:profileID"
97 #define PLT_FILTER_FIELD_DESCRIPTION "dc:description"
98 #define PLT_FILTER_FIELD_LONGDESCRIPTION "upnp:longDescription"
99 #define PLT_FILTER_FIELD_ICON "upnp:icon"
100 #define PLT_FILTER_FIELD_ORIGINALTRACK "upnp:originalTrackNumber"
101 #define PLT_FILTER_FIELD_PROGRAMTITLE "upnp:programTitle"
102 #define PLT_FILTER_FIELD_SERIESTITLE "upnp:seriesTitle"
103 #define PLT_FILTER_FIELD_EPISODE "upnp:episodeNumber"
104 #define PLT_FILTER_FIELD_SEARCHCLASS "upnp:searchClass"
105 #define PLT_FILTER_FIELD_SEARCHABLE "@searchable"
106 #define PLT_FILTER_FIELD_CHILDCOUNT "@childcount"
107 #define PLT_FILTER_FIELD_CONTAINER_CHILDCOUNT "container@childCount"
108 #define PLT_FILTER_FIELD_CONTAINER_SEARCHABLE "container@searchable"
109 #define PLT_FILTER_FIELD_REFID "@refID"
110 
111 #define PLT_FILTER_FIELD_RES "res"
112 #define PLT_FILTER_FIELD_RES_DURATION "res@duration"
113 #define PLT_FILTER_FIELD_RES_DURATION_SHORT "@duration"
114 #define PLT_FILTER_FIELD_RES_SIZE "res@size"
115 #define PLT_FILTER_FIELD_RES_PROTECTION "res@protection"
116 #define PLT_FILTER_FIELD_RES_RESOLUTION "res@resolution"
117 #define PLT_FILTER_FIELD_RES_BITRATE "res@bitrate"
118 #define PLT_FILTER_FIELD_RES_BITSPERSAMPLE "res@bitsPerSample"
119 #define PLT_FILTER_FIELD_RES_NRAUDIOCHANNELS "res@nrAudioChannels"
120 #define PLT_FILTER_FIELD_RES_SAMPLEFREQUENCY "res@sampleFrequency"
121 
122 extern const char* didl_header;
123 extern const char* didl_footer;
124 extern const char* didl_namespace_dc;
125 extern const char* didl_namespace_upnp;
126 extern const char* didl_namespace_dlna;
127 
128 /*----------------------------------------------------------------------
129 | PLT_Didl
130 +---------------------------------------------------------------------*/
136 class PLT_Didl
137 {
138 public:
139  static NPT_Result ToDidl(PLT_MediaObject& object,
140  const NPT_String& filter,
141  NPT_String& didl);
142  static NPT_Result FromDidl(const char* didl,
143  PLT_MediaObjectListReference& objects);
144  static void AppendXmlEscape(NPT_String& out, const char* in);
145  static void AppendXmlUnEscape(NPT_String& out, const char* in);
146  static NPT_Result ParseTimeStamp(const NPT_String& timestamp, NPT_UInt32& seconds);
147  static NPT_String FormatTimeStamp(NPT_UInt32 seconds);
148  static NPT_Result ParseTimeStamp(const NPT_String& in, NPT_TimeStamp& timestamp) {
149  NPT_UInt32 seconds;
150  NPT_Result res = ParseTimeStamp(in, seconds);
151  timestamp = NPT_TimeStamp((double)seconds);
152  return res;
153  }
154 
155  static NPT_UInt32 ConvertFilterToMask(const NPT_String& filter);
156 };
157 
158 #endif /* _PLT_DIDL_H_ */
DIDL manipulation.
Definition: PltDidl.h:136
UPnP AV Media Object reprensentation.
The PLT_MediaObject class is any data entity that can be returned by a ContentDirectory Service from ...
Definition: PltMediaItem.h:179