Skip to content
Permalink
Browse files

platinum: add patch for 11f3d4e

  • Loading branch information...
phate89 committed Dec 3, 2016
1 parent 11f3d4e commit 86657a21d9f9dc37e1a0353c82bcb997279c56e9
Showing with 121 additions and 0 deletions.
  1. +121 −0 lib/libUPnP/patches/0039-platinum-add-resume-playerstate.patch
@@ -0,0 +1,121 @@
From 11f3d4e26f5e0825fadc8aa9224280b7d1eff445 Mon Sep 17 00:00:00 2001
From: phate89 <phates89@gmail.com>
Date: Fri, 29 Jan 2016 13:46:38 +0100
Subject: [PATCH] platinum: add resume playerstate

---
lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp | 2 ++
lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h | 12 +++++++-----
.../Platinum/Source/Devices/MediaServer/PltMediaItem.cpp | 10 ++++++++++
.../Platinum/Source/Devices/MediaServer/PltMediaItem.h | 1 +
.../Source/Devices/MediaServer/PltSyncMediaBrowser.h | 2 +-
5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
index b1ba66f..b8bbfcd 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
@@ -116,6 +116,8 @@ PLT_Didl::ConvertFilterToMask(const NPT_String& filter)
mask |= PLT_FILTER_MASK_ORIGINALTRACK;
} else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPOSITION, len, true) == 0) {
mask |= PLT_FILTER_MASK_LASTPOSITION;
+ } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPLAYERSTATE, len, true) == 0) {
+ mask |= PLT_FILTER_MASK_LASTPLAYERSTATE;
} else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPLAYBACK, len, true) == 0) {
mask |= PLT_FILTER_MASK_LASTPLAYBACK;
} else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_PLAYCOUNT, len, true) == 0) {
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
index 1705f9c..13a87db 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
@@ -87,13 +87,14 @@
#define PLT_FILTER_MASK_REFID NPT_UINT64_C(0x0000000080000000)

#define PLT_FILTER_MASK_LASTPOSITION NPT_UINT64_C(0x0000000100000000)
-#define PLT_FILTER_MASK_LASTPLAYBACK NPT_UINT64_C(0x0000000200000000)
-#define PLT_FILTER_MASK_PLAYCOUNT NPT_UINT64_C(0x0000000400000000)
+#define PLT_FILTER_MASK_LASTPLAYERSTATE NPT_UINT64_C(0x0000000200000000)
+#define PLT_FILTER_MASK_LASTPLAYBACK NPT_UINT64_C(0x0000000400000000)
+#define PLT_FILTER_MASK_PLAYCOUNT NPT_UINT64_C(0x0000000800000000)

-#define PLT_FILTER_MASK_PUBLISHER NPT_UINT64_C(0x0000000800000000)
+#define PLT_FILTER_MASK_PUBLISHER NPT_UINT64_C(0x0000001000000000)

-#define PLT_FILTER_MASK_EPISODE_COUNT NPT_UINT64_C(0x0000001000000000)
-#define PLT_FILTER_MASK_EPISODE_SEASON NPT_UINT64_C(0x0000002000000000)
+#define PLT_FILTER_MASK_EPISODE_COUNT NPT_UINT64_C(0x0000002000000000)
+#define PLT_FILTER_MASK_EPISODE_SEASON NPT_UINT64_C(0x0000004000000000)

#define PLT_FILTER_MASK_XBMC_DATEADDED NPT_UINT64_C(0x0000100000000000)
#define PLT_FILTER_MASK_XBMC_RATING NPT_UINT64_C(0x0000200000000000)
@@ -123,6 +124,7 @@
#define PLT_FILTER_FIELD_SERIESTITLE "upnp:seriesTitle"
#define PLT_FILTER_FIELD_EPISODE "upnp:episodeNumber"
#define PLT_FILTER_FIELD_LASTPOSITION "upnp:lastPlaybackPosition"
+#define PLT_FILTER_FIELD_LASTPLAYERSTATE "upnp:lastPlayerState"
#define PLT_FILTER_FIELD_LASTPLAYBACK "upnp:lastPlaybackTime"
#define PLT_FILTER_FIELD_PLAYCOUNT "upnp:playbackCount"
#define PLT_FILTER_FIELD_SEARCHCLASS "upnp:searchClass"
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
index 96839e4..aae8ac3 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
@@ -242,6 +242,7 @@ PLT_MediaObject::Reset()

m_MiscInfo.original_track_number = 0;
m_MiscInfo.last_position = 0;
+ m_MiscInfo.last_playerstate = "";
m_MiscInfo.last_time = "";
m_MiscInfo.play_count = -1;
m_MiscInfo.dvdregioncode = 0;
@@ -420,6 +421,13 @@ PLT_MediaObject::ToDidl(NPT_UInt64 mask, NPT_String& didl)
didl += "</upnp:lastPlaybackPosition>";
}

+ // last playback position
+ if (mask & PLT_FILTER_MASK_LASTPLAYERSTATE && !m_MiscInfo.last_playerstate.IsEmpty()) {
+ didl += "<upnp:lastPlayerState>";
+ PLT_Didl::AppendXmlEscape(didl, m_MiscInfo.last_playerstate);
+ didl += "</upnp:lastPlayerState>";
+ }
+
// last playback datetime
if (mask & PLT_FILTER_MASK_LASTPLAYBACK && !m_MiscInfo.last_time.IsEmpty()) {
didl += "<upnp:lastPlaybackTime>";
@@ -757,6 +765,8 @@ PLT_MediaObject::FromDidl(NPT_XmlElementNode* entry)
if (NPT_FAILED(str.ToInteger(value))) value = 0;
m_MiscInfo.last_position = value;

+ PLT_XmlHelper::GetChildText(entry, "lastPlayerState", m_MiscInfo.last_playerstate, didl_namespace_upnp, 2048);
+
PLT_XmlHelper::GetChildText(entry, "lastPlaybackTime", m_MiscInfo.last_time, didl_namespace_upnp, 256);
NPT_String parsed_last_time;
for (int format=0; format<=NPT_DateTime::FORMAT_RFC_1036; format++) {
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
index 5712b9a..9305d3a 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h
@@ -131,6 +131,7 @@ typedef struct {
NPT_String toc;
NPT_String user_annotation; //TODO: can be multiple
NPT_UInt32 last_position;
+ NPT_String last_playerstate;
NPT_String last_time;
NPT_Int32 play_count;
} PLT_MiscInfo;
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.h
index e52fb5a..bed141a 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.h
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.h
@@ -70,7 +70,7 @@ typedef struct PLT_CapabilitiesData {
typedef NPT_Reference<PLT_CapabilitiesData> PLT_CapabilitiesDataReference;

// explicitely specify res otherwise WMP won't return a URL!
-#define PLT_DEFAULT_FILTER "dc:date,dc:description,upnp:longDescription,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:rating,upnp:lastPlaybackPosition,upnp:lastPlaybackTime,upnp:playbackCount,upnp:originalTrackNumber,upnp:episodeNumber,upnp:programTitle,upnp:seriesTitle,upnp:album,upnp:artist,upnp:author,upnp:director,dc:publisher,searchable,childCount,dc:title,dc:creator,upnp:actor,res@resolution,upnp:episodeCount,upnp:episodeSeason,xbmc:dateadded,xbmc:rating,xbmc:votes,xbmc:artwork,xbmc:uniqueidentifier,xbmc:country,xbmc:userrating"
+#define PLT_DEFAULT_FILTER "dc:date,dc:description,upnp:longDescription,upnp:genre,res,res@duration,res@size,upnp:albumArtURI,upnp:rating,upnp:lastPlaybackPosition,upnp:lastPlayerState,upnp:lastPlaybackTime,upnp:playbackCount,upnp:originalTrackNumber,upnp:episodeNumber,upnp:programTitle,upnp:seriesTitle,upnp:album,upnp:artist,upnp:author,upnp:director,dc:publisher,searchable,childCount,dc:title,dc:creator,upnp:actor,res@resolution,upnp:episodeCount,upnp:episodeSeason,xbmc:dateadded,xbmc:rating,xbmc:votes,xbmc:artwork,xbmc:uniqueidentifier,xbmc:country,xbmc:userrating"

/*----------------------------------------------------------------------
| PLT_MediaContainerListener
--
2.10.2.windows.1

0 comments on commit 86657a2

Please sign in to comment.
You can’t perform that action at this time.