unsigned int flags = READ_TRUNCATED | READ_BITRATE | READ_CHUNKED;
- /*
- * There are 4 buffer modes available (configurable in as.xml)
- * 0) Buffer all internet filesystems (like 2 but additionally also ftp, webdav, etc.) (default)
- * 1) Buffer all filesystems (including local)
- * 2) Only buffer true internet filesystems (streams) (http, etc.)
- * 3) No buffer
- */
-
- if (g_advancedSettings.m_networkBufferMode == 3)
- {
- flags |= READ_NO_CACHE;
- }
- else if (g_advancedSettings.m_networkBufferMode == 0 || g_advancedSettings.m_networkBufferMode == 2)
- {
- if (URIUtils::IsInternetStream(CURL(strFile), (g_advancedSettings.m_networkBufferMode == 0) ) )
- flags |= READ_CACHED;
- else
- flags |= READ_NO_CACHE;
- }
- else if (!URIUtils::IsOnDVD(strFile) && !URIUtils::IsBluray(strFile))
- {
- flags |= READ_CACHED; // Force cache for all others (in buffer mode 3)
- }
+ if (URIUtils::IsOnDVD(strFile) || URIUtils::IsBluray(strFile))
+ flags |= READ_NO_CACHE; // Never cache these
if (content == "video/mp4" || content == "video/x-msvideo" || content == "video/avi")
flags |= READ_MULTI_STREAM;
#include "Util.h"
#include "URL.h"
#include "utils/StringUtils.h"
+#include "settings/AdvancedSettings.h"
#include "commons/Exception.h"
}
CURL url(URIUtils::SubstitutePath(strFileName));
- bool isInternetStream = URIUtils::IsInternetStream(url, true);
- if ( (flags & READ_NO_CACHE) == 0 && isInternetStream && !CUtil::IsPicture(strFileName) )
- m_flags |= READ_CACHED;
+
+ /*
+ * There are 4 buffer modes available (configurable in as.xml)
+ * 0) Buffer all internet filesystems (like 2 but additionally also ftp, webdav, etc.) (default)
+ * 1) Buffer all filesystems (including local)
+ * 2) Only buffer true internet filesystems (streams) (http, etc.)
+ * 3) No buffer
+ */
+ if ( (flags & READ_NO_CACHE) == 0 && !CUtil::IsPicture(strFileName) )
+ {
+ if (g_advancedSettings.m_networkBufferMode == 0 || g_advancedSettings.m_networkBufferMode == 2)
+ {
+ if (URIUtils::IsInternetStream(url, (g_advancedSettings.m_networkBufferMode == 0) ) )
+ flags |= READ_CACHED;
+ }
+ else if (g_advancedSettings.m_networkBufferMode == 1)
+ {
+ flags |= READ_CACHED; // Force cache for all others (in buffer mode 1)
+ }
+ }
if (m_flags & READ_CACHED)
{
// for internet stream, if it contains multiple stream, file cache need handle it specially.
- m_pFile = new CFileCache((m_flags & READ_MULTI_STREAM)!=0 && isInternetStream);
+ m_pFile = new CFileCache((m_flags & READ_MULTI_STREAM) != 0 && URIUtils::IsInternetStream(url, true));
return m_pFile->Open(url);
}