Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / lib / libUPnP / patches / 0035-platinum-Changes-to-external-subtitles-over-UPnP-wor.patch
blob880b331e5248b0ab86a8fa63f0a1ed4c698c6761
1 From ec171eae6aad8bbf51fdf52c97446db6418c96a1 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Chwia=C5=82a?= <rchwiala@gmail.com>
3 Date: Sat, 17 Jan 2015 15:55:52 +0100
4 Subject: [PATCH] platinum Changes to external subtitles over UPnP works
6 Added custom data to resources field - needed to add some attributes to res.
7 Added new struct PLK_SecResource - needed by Somasung devices. It's not specialized struct (just general one), because I can't find any "sec" specification.
8 ---
9 .../Source/Devices/MediaServer/PltDidl.cpp | 1 +
10 .../Source/Devices/MediaServer/PltMediaItem.cpp | 41 +++++++++++++++++++++-
11 .../Source/Devices/MediaServer/PltMediaItem.h | 12 +++++++
12 3 files changed, 53 insertions(+), 1 deletion(-)
14 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
15 index 7b853c8..b58aa50 100644
16 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
17 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
18 @@ -48,6 +48,7 @@ const char* didl_header = "<DIDL-Lite xmlns=\"urn:schemas-upnp-org:metad
19 " xmlns:dc=\"http://purl.org/dc/elements/1.1/\""
20 " xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\""
21 " xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\""
22 + " xmlns:sec=\"http://www.sec.co.kr/\""
23 " xmlns:xbmc=\"urn:schemas-xbmc-org:metadata-1-0/\">";
24 const char* didl_footer = "</DIDL-Lite>";
25 const char* didl_namespace_dc = "http://purl.org/dc/elements/1.1/";
26 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
27 index 4db2d45..f937df2 100644
28 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
29 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
30 @@ -528,12 +528,51 @@ PLT_MediaObject::ToDidl(NPT_UInt64 mask, NPT_String& didl)
32 didl += " protocolInfo=\"";
33 PLT_Didl::AppendXmlEscape(didl, m_Resources[i].m_ProtocolInfo.ToString());
34 - didl += "\">";
35 + didl += "\"";
36 + /* adding custom data */
37 + NPT_List<NPT_Map<NPT_String, NPT_String>::Entry*>::Iterator entry = m_Resources[i].m_CustomData.GetEntries().GetFirstItem();
38 + while (entry)
39 + {
40 + didl += " ";
41 + PLT_Didl::AppendXmlEscape(didl, (*entry)->GetKey());
42 + didl += "=\"";
43 + PLT_Didl::AppendXmlEscape(didl, (*entry)->GetValue());
44 + didl += "\"";
46 + entry++;
47 + }
49 + didl += ">";
50 PLT_Didl::AppendXmlEscape(didl, m_Resources[i].m_Uri);
51 didl += "</res>";
55 + //sec resources related
56 + for (NPT_Cardinal i = 0; i < m_SecResources.GetItemCount(); i++) {
57 + didl += "<sec:";
58 + PLT_Didl::AppendXmlEscape(didl, m_SecResources[i].name);
60 + NPT_List<NPT_Map<NPT_String, NPT_String>::Entry*>::Iterator entry = m_SecResources[i].attributes.GetEntries().GetFirstItem();
61 + while (entry)
62 + {
63 + didl += " sec:";
64 + PLT_Didl::AppendXmlEscape(didl, (*entry)->GetKey());
65 + didl += "=\"";
66 + PLT_Didl::AppendXmlEscape(didl, (*entry)->GetValue());
67 + didl += "\"";
69 + entry++;
70 + }
72 + didl += ">";
73 + PLT_Didl::AppendXmlEscape(didl, m_SecResources[i].value);
75 + didl += "</sec:";
76 + PLT_Didl::AppendXmlEscape(didl, m_SecResources[i].name);
77 + didl += ">";
78 + }
80 // xbmc dateadded
81 if ((mask & PLT_FILTER_MASK_XBMC_DATEADDED) && !m_XbmcInfo.date_added.IsEmpty()) {
82 didl += "<xbmc:dateadded>";
83 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
84 index deb4961..6461b81 100644
85 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
86 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
87 @@ -172,6 +172,12 @@ typedef struct {
88 NPT_String unique_identifier;
89 } PLT_XbmcInfo;
91 +typedef struct {
92 + NPT_String name;
93 + NPT_Map<NPT_String, NPT_String> attributes;
94 + NPT_String value;
95 +} PLT_SecResource;
97 /*----------------------------------------------------------------------
98 | PLT_MediaItemResource
99 +---------------------------------------------------------------------*/
100 @@ -192,6 +198,9 @@ public:
101 NPT_UInt32 m_NbAudioChannels;
102 NPT_String m_Resolution;
103 NPT_UInt32 m_ColorDepth;
104 + /* to add custom data to resource, that are not standard one, or are only
105 + proper for some type of devices (UPnP)*/
106 + NPT_Map<NPT_String, NPT_String> m_CustomData;
109 /*----------------------------------------------------------------------
110 @@ -250,6 +259,9 @@ public:
111 /* resources related */
112 NPT_Array<PLT_MediaItemResource> m_Resources;
114 + /* sec resources related */
115 + NPT_Array<PLT_SecResource> m_SecResources;
117 /* XBMC specific */
118 PLT_XbmcInfo m_XbmcInfo;
121 1.8.3.msysgit.0