Skip to content

Commit

Permalink
Merge pull request #883 from CastagnaIT/isa_improvs_omega
Browse files Browse the repository at this point in the history
[backport] Improvements for InputStreamAdaptive
  • Loading branch information
phunkyfish authored Aug 24, 2024
2 parents cfb87e4 + 20f1bde commit 8855656
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="21.8.5"
version="21.8.6"
name="IPTV Simple Client"
provider-name="nightik and Ross Nicholson">
<requires>@ADDON_DEPENDS@
Expand Down
6 changes: 6 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v21.8.6
- 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

v21.8.5
- Translations updates from Weblate
- be_by, de_de, es_es, it_it, pt_br, sl_si, zh_cn
Expand Down
22 changes: 17 additions & 5 deletions src/iptvsimple/utilities/StreamUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ using namespace iptvsimple::utilities;

void StreamUtils::SetAllStreamProperties(std::vector<kodi::addon::PVRStreamProperty>& properties, const iptvsimple::data::Channel& channel, const std::string& streamURL, bool isChannelURL, std::map<std::string, std::string>& catchupProperties, std::shared_ptr<InstanceSettings>& 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);
Expand All @@ -40,7 +48,7 @@ void StreamUtils::SetAllStreamProperties(std::vector<kodi::addon::PVRStreamPrope
streamType = StreamUtils::InspectStreamType(streamURL, channel);

// Using kodi's built in inputstreams
if (StreamUtils::UseKodiInputstreams(streamType, settings))
if (!isISAdaptiveSet && StreamUtils::UseKodiInputstreams(streamType, settings))
{
std::string ffmpegStreamURL = StreamUtils::GetURLWithFFmpegReconnectOptions(streamURL, streamType, channel, settings);

Expand Down Expand Up @@ -105,9 +113,11 @@ void StreamUtils::SetAllStreamProperties(std::vector<kodi::addon::PVRStreamPrope
if (!streamUrlSet)
properties.emplace_back(PVR_STREAM_PROPERTY_STREAMURL, streamURL);

properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, INPUTSTREAM_ADAPTIVE);
properties.emplace_back("inputstream.adaptive.manifest_type", StreamUtils::GetManifestType(streamType));
if (streamType == StreamType::HLS || streamType == StreamType::DASH)
if (!isISAdaptiveSet)
properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, INPUTSTREAM_ADAPTIVE);

if (streamType == StreamType::HLS || streamType == StreamType::DASH ||
streamType == StreamType::SMOOTH_STREAMING)
properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, StreamUtils::GetMimeType(streamType));
}
}
Expand Down Expand Up @@ -287,6 +297,8 @@ const std::string StreamUtils::GetMimeType(const StreamType& streamType)
return "application/x-mpegURL";
case StreamType::DASH:
return "application/xml+dash";
case StreamType::SMOOTH_STREAMING:
return "application/vnd.ms-sstr+xml";
case StreamType::TS:
return "video/mp2t";
default:
Expand Down

0 comments on commit 8855656

Please sign in to comment.