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 diff --git a/src/iptvsimple/utilities/StreamUtils.cpp b/src/iptvsimple/utilities/StreamUtils.cpp index 76eddc79..f22613ad 100644 --- a/src/iptvsimple/utilities/StreamUtils.cpp +++ b/src/iptvsimple/utilities/StreamUtils.cpp @@ -20,9 +20,36 @@ 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)) + // 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); @@ -40,7 +67,7 @@ void StreamUtils::SetAllStreamProperties(std::vector