Skip to content

Commit

Permalink
[FileSystem] deprecate use of READ_CHUNKED flag
Browse files Browse the repository at this point in the history
  • Loading branch information
thexai committed May 11, 2024
1 parent 436befa commit 22b7764
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CSoundPacket *CActiveAESound::GetSound(bool orig)

bool CActiveAESound::Prepare()
{
unsigned int flags = READ_TRUNCATED | READ_CHUNKED;
unsigned int flags = READ_TRUNCATED;
m_pFile = new CFile();

if (!m_pFile->Open(m_filename, flags))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
}

// our file interface handles all these types of streams
return std::make_shared<CDVDInputStreamFile>(
finalFileitem, XFILE::READ_TRUNCATED | XFILE::READ_BITRATE | XFILE::READ_CHUNKED);
return std::make_shared<CDVDInputStreamFile>(finalFileitem,
XFILE::READ_TRUNCATED | XFILE::READ_BITRATE);
}

std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer, const CFileItem &fileitem, const std::vector<std::string>& filenames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1244,8 +1244,8 @@ void CDVDInputStreamBluray::SetupPlayerSettings()

bool CDVDInputStreamBluray::OpenStream(CFileItem &item)
{
m_pstream = std::make_unique<CDVDInputStreamFile>(item, READ_TRUNCATED | READ_BITRATE |
READ_CHUNKED | READ_NO_CACHE);
m_pstream =
std::make_unique<CDVDInputStreamFile>(item, READ_TRUNCATED | READ_BITRATE | READ_NO_CACHE);

if (!m_pstream->Open())
{
Expand Down
2 changes: 0 additions & 2 deletions xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ bool CDVDInputStreamFile::Open()
// If this file is audio and/or video (= not a subtitle) flag to caller
if (!VIDEO::IsSubtitle(m_item))
flags |= READ_AUDIO_VIDEO;
else
flags |= READ_NO_BUFFER; // disable CFileStreamBuffer for subtitles

std::string content = m_item.GetMimeType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ bool CDVDInputStreamNavigator::Open()
if (m_item.IsDiscImage())
{
// if dvd image file (ISO or alike) open using libdvdnav stream callback functions
m_pstream = std::make_unique<CDVDInputStreamFile>(
m_item, XFILE::READ_TRUNCATED | XFILE::READ_BITRATE | XFILE::READ_CHUNKED);
m_pstream =
std::make_unique<CDVDInputStreamFile>(m_item, XFILE::READ_TRUNCATED | XFILE::READ_BITRATE);
#if DVDNAV_VERSION >= 60100
if (!m_pstream->Open() || m_dll.dvdnav_open_stream2(&m_dvdnav, m_pstream.get(), &loggerCallback,
&m_dvdnav_stream_cb) != DVDNAV_STATUS_OK)
Expand Down
4 changes: 2 additions & 2 deletions xbmc/filesystem/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall
CURL url(url2);
if (StringUtils::StartsWith(url.Get(), "zip://") || URIUtils::IsInAPK(url.Get()))
url.SetOptions("?cache=no");
if (file.Open(url.Get(), READ_TRUNCATED | READ_CHUNKED))
if (file.Open(url.Get(), READ_TRUNCATED | READ_NO_CACHE | READ_NO_BUFFER))
{

CFile newFile;
Expand Down Expand Up @@ -389,7 +389,7 @@ bool CFile::ShouldUseStreamBuffer(const CURL& url)
if (m_flags & READ_NO_BUFFER)
return false;

if (m_flags & READ_CHUNKED || m_pFile->GetChunkSize() > 0)
if (m_flags & READ_AUDIO_VIDEO)
return true;

// file size > 200 MB but not in optical disk
Expand Down
6 changes: 4 additions & 2 deletions xbmc/filesystem/FileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ bool CFileCache::Open(const CURL& url)

CLog::Log(LOGDEBUG, "CFileCache::{} - <{}> opening", __FUNCTION__, m_sourcePath);

// opening the source file.
if (!m_source.Open(url.Get(), READ_NO_CACHE | READ_TRUNCATED | READ_CHUNKED))
// Opening the source file.
// The READ_NO_CACHE and READ_NO_BUFFER flags are required to avoid create other intances of
// FileCache or StreamBuffer since CFile::Open is called again in loop
if (!m_source.Open(url.Get(), READ_NO_CACHE | READ_TRUNCATED | READ_NO_BUFFER))
{
CLog::Log(LOGERROR, "CFileCache::{} - <{}> failed to open", __FUNCTION__, m_sourcePath);
Close();
Expand Down

0 comments on commit 22b7764

Please sign in to comment.