*/
#include "DVDInputStreamFFmpeg.h"
+#include "xbmc/playlists/PlayListM3U.h"
+#include "settings/Settings.h"
+#include "Util.h"
using namespace XFILE;
bool CDVDInputStreamFFmpeg::Open(const char* strFile, const std::string& content)
{
+ CFileItem item(strFile, false);
+ if (item.IsInternetStream() && item.IsType(".m3u8"))
+ {
+ // get the available bandwidth and determine the most appropriate stream
+ int bandwidth = CSettings::Get().GetInt("network.bandwidth");
+ if(bandwidth <= 0)
+ bandwidth = INT_MAX;
+ strFile = PLAYLIST::CPlayListM3U::GetBestBandwidthStream(strFile, bandwidth);
+ }
+
if (!CDVDInputStream::Open(strFile, content))
return false;
m_filename = g_mediaManager.TranslateDevicePath("");
}
- // before creating the input stream, if this is an HLS playlist then get the
- // most appropriate bitrate based on our network settings
- // ensure to strip off the url options by using a temp CURL object
- if (StringUtils::StartsWith(filename, "http://") &&
- StringUtils::EndsWith(CURL(filename).GetFileName(), ".m3u8"))
- {
- // get the available bandwidth (as per user settings)
- int maxrate = CSettings::Get().GetInt("network.bandwidth");
- if(maxrate <= 0)
- maxrate = INT_MAX;
-
- // determine the most appropriate stream
- m_filename = PLAYLIST::CPlayListM3U::GetBestBandwidthStream(m_filename, (size_t)maxrate);
- }
m_pInputStream = CDVDFactoryInputStream::CreateInputStream(this, m_filename, m_mimetype);
if(m_pInputStream == NULL)
{
m_filename = g_mediaManager.TranslateDevicePath("");
}
- // before creating the input stream, if this is an HLS playlist then get the
- // most appropriate bitrate based on our network settings
- // ensure to strip off the url options by using a temp CURL object
- if (StringUtils::StartsWith(filename, "http://") && StringUtils::EndsWith(CURL(filename).GetFileName(), ".m3u8"))
- {
- // get the available bandwidth (as per user settings)
- int maxrate = CSettings::Get().GetInt("network.bandwidth");
- if(maxrate <= 0)
- maxrate = INT_MAX;
-
- // determine the most appropriate stream
- m_filename = PLAYLIST::CPlayListM3U::GetBestBandwidthStream(m_filename, (size_t)maxrate);
- }
m_pInputStream = CDVDFactoryInputStream::CreateInputStream(this, m_filename, m_mimetype);
if(m_pInputStream == NULL)
{