Skip to content

Commit 287042d

Browse files
authored
Merge pull request #900 from phunkyfish/media-inputstream-omega
Correctly set inputstream properties for media entries - Omega
2 parents 2cc1419 + f77284e commit 287042d

File tree

9 files changed

+165
-52
lines changed

9 files changed

+165
-52
lines changed

pvr.iptvsimple/addon.xml.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon
33
id="pvr.iptvsimple"
4-
version="21.8.7"
4+
version="21.9.1"
55
name="IPTV Simple Client"
66
provider-name="nightik and Ross Nicholson">
77
<requires>@ADDON_DEPENDS@

pvr.iptvsimple/changelog.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v21.9.1
2+
- Fix release build
3+
4+
v21.9.0
5+
- Correctly set inputstream properties for media entries
6+
17
v21.8.7
28
- Fix #KODIPROP parsing from playlists
39
- Fix wrong fix to manifest user-agent header for inputstream.adaptive

src/IptvSimple.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,12 @@ PVR_ERROR IptvSimple::GetRecordings(bool deleted, kodi::addon::PVRRecordingsResu
412412

413413
PVR_ERROR IptvSimple::GetRecordingStreamProperties(const kodi::addon::PVRRecording& recording, std::vector<kodi::addon::PVRStreamProperty>& properties)
414414
{
415+
auto mediaEntry = m_media.GetMediaEntry(recording);
415416
std::string url = m_media.GetMediaEntryURL(recording);
416417

417-
if (!url.empty())
418+
if (!mediaEntry.GetMediaEntryId().empty() && !url.empty())
418419
{
419-
properties.emplace_back(PVR_STREAM_PROPERTY_STREAMURL, url);
420+
StreamUtils::SetAllStreamProperties(properties, mediaEntry, url, m_settings);
420421

421422
return PVR_ERROR_NO_ERROR;
422423
}

src/iptvsimple/Media.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ bool Media::IsInVirtualMediaEntryFolder(const MediaEntry& mediaEntryToCheck) con
136136
return false;
137137
}
138138

139+
const MediaEntry Media::GetMediaEntry(const kodi::addon::PVRRecording& recording)
140+
{
141+
Logger::Log(LEVEL_INFO, "%s", __func__);
142+
143+
return GetMediaEntry(recording.GetRecordingId());
144+
}
145+
139146
const std::string Media::GetMediaEntryURL(const kodi::addon::PVRRecording& recording)
140147
{
141148
Logger::Log(LEVEL_INFO, "%s", __func__);

src/iptvsimple/Media.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace iptvsimple
2525
void GetMedia(std::vector<kodi::addon::PVRRecording>& kodiRecordings);
2626
int GetNumMedia() const;
2727
void Clear();
28+
const data::MediaEntry GetMediaEntry(const kodi::addon::PVRRecording& mediaEntry);
2829
const std::string GetMediaEntryURL(const kodi::addon::PVRRecording& mediaEntry);
2930
const iptvsimple::data::MediaEntry* FindMediaEntry(const std::string& id, const std::string& displayName) const;
3031

src/iptvsimple/StreamManager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ StreamEntry StreamManager::StreamEntryLookup(const Channel& channel, const std::
7070

7171
if (!streamEntry)
7272
{
73-
StreamType streamType = StreamUtils::GetStreamType(streamTestUrl, channel);
73+
StreamType streamType = StreamUtils::GetStreamType(streamTestUrl, channel.GetProperty(PVR_STREAM_PROPERTY_MIMETYPE), channel.IsCatchupTSStream());
7474
if (streamType == StreamType::OTHER_TYPE)
75-
streamType = StreamUtils::InspectStreamType(streamTestUrl, channel);
75+
streamType = StreamUtils::InspectStreamType(streamTestUrl, channel.GetCatchupMode());
7676

7777
streamEntry = std::make_shared<StreamEntry>();
7878
streamEntry->SetStreamKey(streamKey);

src/iptvsimple/data/MediaEntry.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,12 @@ void MediaEntry::UpdateTo(kodi::addon::PVRRecording& left, bool isInVirtualMedia
311311

312312
left.SetDirectory(newDirectory);
313313
}
314+
315+
std::string MediaEntry::GetProperty(const std::string& propName) const
316+
{
317+
auto propPair = m_properties.find(propName);
318+
if (propPair != m_properties.end())
319+
return propPair->second;
320+
321+
return {};
322+
}

src/iptvsimple/utilities/StreamUtils.cpp

+128-41
Large diffs are not rendered by default.

src/iptvsimple/utilities/StreamUtils.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#pragma once
99

1010
#include "../data/Channel.h"
11+
#include "../data/MediaEntry.h"
1112
#include "../data/StreamEntry.h"
1213

1314
#include <map>
@@ -29,12 +30,13 @@ namespace iptvsimple
2930
{
3031
public:
3132
static void 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<iptvsimple::InstanceSettings>& settings);
32-
static const StreamType GetStreamType(const std::string& url, const iptvsimple::data::Channel& channel);
33-
static const StreamType InspectStreamType(const std::string& url, const iptvsimple::data::Channel& channel);
33+
static void SetAllStreamProperties(std::vector<kodi::addon::PVRStreamProperty>& properties, const iptvsimple::data::MediaEntry& mediaEntry, const std::string& streamUrl, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
34+
static const StreamType GetStreamType(const std::string& url, const std::string& mimeType, bool isCatchupTSStream);
35+
static const StreamType InspectStreamType(const std::string& url, iptvsimple::CatchupMode catchupMode);
3436
static const std::string GetManifestType(const StreamType& streamType);
3537
static const std::string GetMimeType(const StreamType& streamType);
3638
static bool HasMimeType(const StreamType& streamType);
37-
static std::string GetURLWithFFmpegReconnectOptions(const std::string& streamUrl, const StreamType& streamType, const iptvsimple::data::Channel& channel, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
39+
static std::string GetURLWithFFmpegReconnectOptions(const std::string& streamUrl, const StreamType& streamType, const std::string& inputstreamName, bool hasHTTPReconnect, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
3840
static std::string AddHeader(const std::string& headerTarget, const std::string& headerName, const std::string& headerValue, bool encodeHeaderValue);
3941
static std::string AddHeaderToStreamUrl(const std::string& streamUrl, const std::string& headerName, const std::string& headerValue);
4042
static bool UseKodiInputstreams(const StreamType& streamType, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
@@ -43,9 +45,9 @@ namespace iptvsimple
4345
static std::string GetEffectiveInputStreamName(const StreamType& streamType, const iptvsimple::data::Channel& channel, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
4446

4547
private:
46-
static bool SupportsFFmpegReconnect(const StreamType& streamType, const iptvsimple::data::Channel& channel);
47-
static void InspectAndSetFFmpegDirectStreamProperties(std::vector<kodi::addon::PVRStreamProperty>& properties, const iptvsimple::data::Channel& channel, const std::string& streamUrl, bool isChannelURL, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
48-
static void SetFFmpegDirectManifestTypeStreamProperty(std::vector<kodi::addon::PVRStreamProperty>& properties, const iptvsimple::data::Channel& channel, const std::string& streamURL, const StreamType& streamType);
48+
static bool SupportsFFmpegReconnect(const StreamType& streamType, const std::string& inputstreamName);
49+
static void InspectAndSetFFmpegDirectStreamProperties(std::vector<kodi::addon::PVRStreamProperty>& properties, const std::string& mimeType, const std::string& manifestType, iptvsimple::CatchupMode catchupMode, bool isCatchupTSStream, const std::string& streamUrl, std::shared_ptr<iptvsimple::InstanceSettings>& settings);
50+
static void SetFFmpegDirectManifestTypeStreamProperty(std::vector<kodi::addon::PVRStreamProperty>& properties, const std::string& manifestType, const std::string& streamURL, const StreamType& streamType);
4951
static bool CheckInputstreamInstalledAndEnabled(const std::string& inputstreamName);
5052

5153
};

0 commit comments

Comments
 (0)