move HLS variant selection to a DVDInputStreamFFmpeg. DVDPlayer may not have direct url
authorThomas Amland <thomas.amland@gmail.com>
Fri, 24 Jan 2014 13:49:54 +0000 (14:49 +0100)
committerThomas Amland <thomas.amland@gmail.com>
Mon, 27 Jan 2014 20:43:14 +0000 (21:43 +0100)
xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp
xbmc/cores/dvdplayer/DVDPlayer.cpp
xbmc/cores/omxplayer/OMXPlayer.cpp

index 1f780f5..c2d972d 100644 (file)
@@ -19,6 +19,9 @@
  */
 
 #include "DVDInputStreamFFmpeg.h"
+#include "xbmc/playlists/PlayListM3U.h"
+#include "settings/Settings.h"
+#include "Util.h"
 
 using namespace XFILE;
 
@@ -46,6 +49,16 @@ bool CDVDInputStreamFFmpeg::IsEOF()
 
 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;
 
index 4170b17..caf1cba 100644 (file)
@@ -662,20 +662,6 @@ bool CDVDPlayer::OpenInputStream()
     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)
   {
index c039d80..a26183f 100644 (file)
@@ -708,19 +708,6 @@ bool COMXPlayer::OpenInputStream()
     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)
   {