From a5263b3294a3f127104db7ba54c70edcb35331f4 Mon Sep 17 00:00:00 2001 From: CastagnaIT Date: Wed, 21 Aug 2024 16:29:43 +0200 Subject: [PATCH 1/5] [StreamUtils] Removed inputstream.adaptive.manifest_type This is obsolete already deprecated on Kodi 21 --- src/iptvsimple/utilities/StreamUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iptvsimple/utilities/StreamUtils.cpp b/src/iptvsimple/utilities/StreamUtils.cpp index 76eddc79..d3a72554 100644 --- a/src/iptvsimple/utilities/StreamUtils.cpp +++ b/src/iptvsimple/utilities/StreamUtils.cpp @@ -106,7 +106,7 @@ void StreamUtils::SetAllStreamProperties(std::vector Date: Wed, 21 Aug 2024 17:01:42 +0200 Subject: [PATCH 2/5] [StreamUtils] Add smoothstreaming mimetype for ISAdaptive --- src/iptvsimple/utilities/StreamUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iptvsimple/utilities/StreamUtils.cpp b/src/iptvsimple/utilities/StreamUtils.cpp index d3a72554..ae82daba 100644 --- a/src/iptvsimple/utilities/StreamUtils.cpp +++ b/src/iptvsimple/utilities/StreamUtils.cpp @@ -107,7 +107,8 @@ void StreamUtils::SetAllStreamProperties(std::vector Date: Wed, 21 Aug 2024 16:50:09 +0200 Subject: [PATCH 3/5] [StreamUtils] Set headers also on inputstream.adaptive.stream_headers Usually if a service require user-agent header must be set on both manifests and streams --- src/iptvsimple/utilities/StreamUtils.cpp | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/iptvsimple/utilities/StreamUtils.cpp b/src/iptvsimple/utilities/StreamUtils.cpp index ae82daba..f922c4eb 100644 --- a/src/iptvsimple/utilities/StreamUtils.cpp +++ b/src/iptvsimple/utilities/StreamUtils.cpp @@ -20,6 +20,25 @@ using namespace iptvsimple; using namespace iptvsimple::data; using namespace iptvsimple::utilities; +namespace +{ +bool SplitUrlProtocolOpts(const std::string& streamURL, + std::string& url, + std::string& encodedProtocolOptions) +{ + size_t found = streamURL.find_first_of('|'); + if (found != std::string::npos) + { + // Headers found, split and url-encode them + url = streamURL.substr(0, found); + const std::string& protocolOptions = streamURL.substr(found + 1, streamURL.length()); + encodedProtocolOptions = StreamUtils::GetUrlEncodedProtocolOptions(protocolOptions); + return true; + } + return false; +} +} // unnamed namespace + void StreamUtils::SetAllStreamProperties(std::vector& properties, const iptvsimple::data::Channel& channel, const std::string& streamURL, bool isChannelURL, std::map& catchupProperties, std::shared_ptr& settings) { if (ChannelSpecifiesInputstream(channel)) @@ -83,19 +102,17 @@ void StreamUtils::SetAllStreamProperties(std::vector Date: Thu, 22 Aug 2024 18:32:11 +0200 Subject: [PATCH 4/5] [StreamUtils] Always set headers and mimetype for inputstream.adaptive --- src/iptvsimple/utilities/StreamUtils.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/iptvsimple/utilities/StreamUtils.cpp b/src/iptvsimple/utilities/StreamUtils.cpp index f922c4eb..f22613ad 100644 --- a/src/iptvsimple/utilities/StreamUtils.cpp +++ b/src/iptvsimple/utilities/StreamUtils.cpp @@ -41,7 +41,15 @@ bool SplitUrlProtocolOpts(const std::string& streamURL, void StreamUtils::SetAllStreamProperties(std::vector& properties, const iptvsimple::data::Channel& channel, const std::string& streamURL, bool isChannelURL, std::map& catchupProperties, std::shared_ptr& settings) { - if (ChannelSpecifiesInputstream(channel)) + // Check if the channel has explicitly set up the use of inputstream.adaptive, + // if so, the best behaviour for media services is: + // - Always add mimetype to prevent kodi core to make an HTTP HEADER requests + // this because in some cases services refuse this request and can also deny downloads + // - If requested by settings, always add the "user-agent" header to ISA properties + const bool isISAdaptiveSet = + channel.GetProperty(PVR_STREAM_PROPERTY_INPUTSTREAM) == INPUTSTREAM_ADAPTIVE; + + if (!isISAdaptiveSet && ChannelSpecifiesInputstream(channel)) { // Channel has an inputstream class set so we only set the stream URL properties.emplace_back(PVR_STREAM_PROPERTY_STREAMURL, streamURL); @@ -59,7 +67,7 @@ void StreamUtils::SetAllStreamProperties(std::vector Date: Fri, 23 Aug 2024 12:58:39 +0200 Subject: [PATCH 5/5] changelog and version 22.1.1 --- pvr.iptvsimple/addon.xml.in | 2 +- pvr.iptvsimple/changelog.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pvr.iptvsimple/addon.xml.in b/pvr.iptvsimple/addon.xml.in index 929577c0..379a5dc8 100644 --- a/pvr.iptvsimple/addon.xml.in +++ b/pvr.iptvsimple/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.iptvsimple/changelog.txt b/pvr.iptvsimple/changelog.txt index f785f366..2922320d 100644 --- a/pvr.iptvsimple/changelog.txt +++ b/pvr.iptvsimple/changelog.txt @@ -1,3 +1,9 @@ +v22.1.1 +- Always add mimetype for inputstream.adaptive +- Better handled user-agent header for inputstream.adaptive use cases +- Fix missing manifest user-agent header for inputstream.adaptive +- Add missing SmoothStreaming mimetype for inputstream.adaptive + v22.1.0 - PVR Add-on API v9.0.0