Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FileSystem] deprecate use of READ_CHUNKED flag #25158

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xbmc/addons/interfaces/Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ unsigned int Interface_Filesystem::TranslateFileReadBitsToKodi(unsigned int addo

if (addonFlags & ADDON_READ_TRUNCATED)
kodiFlags |= READ_TRUNCATED;
if (addonFlags & ADDON_READ_CHUNKED)
kodiFlags |= READ_CHUNKED;
if (addonFlags & ADDON_READ_CACHED)
kodiFlags |= READ_CACHED;
if (addonFlags & ADDON_READ_NO_CACHE)
Expand All @@ -153,6 +151,8 @@ unsigned int Interface_Filesystem::TranslateFileReadBitsToKodi(unsigned int addo
kodiFlags |= READ_AFTER_WRITE;
if (addonFlags & READ_REOPEN)
kodiFlags |= READ_REOPEN;
if (addonFlags & ADDON_READ_NO_BUFFER)
kodiFlags |= READ_NO_BUFFER;

return kodiFlags;
}
Expand Down
14 changes: 11 additions & 3 deletions xbmc/addons/kodi-dev-kit/include/kodi/c-api/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ extern "C"
/// @brief **0000 0000 0010** :\n
/// Indicate that that caller support read in the minimum defined
/// chunk size, this disables internal cache then.
/// This flag is deprecated, instead use ADDON_READ_NO_CACHE to disable FileCache and
/// ADDON_READ_NO_BUFFER to disable StreamBuffer. On the contrary to explicitly indicate that
/// the file has audio/video content (suitable for caching), use the READ_AUDIO_VIDEO flag.
ADDON_READ_CHUNKED = 0x02,

/// @brief **0000 0000 0100** :\n
Expand All @@ -83,8 +86,9 @@ extern "C"
ADDON_READ_MULTI_STREAM = 0x20,

/// @brief **0000 0100 0000** :\n
/// indicate to the caller file is audio and/or video (and e.g. may
/// grow).
/// Indicate to the caller file is audio and/or video and is suitable for caching with FileCache or StreamBuffer.
/// The final method used will depend on the user's settings and file location, e.g. user can disable FileCache.
/// This flag ensures that at least the buffer size necessary to read with the appropriate chunk size will be used.
ADDON_READ_AUDIO_VIDEO = 0x40,

/// @brief **0000 1000 0000** :\n
Expand All @@ -93,7 +97,11 @@ extern "C"

/// @brief **0001 0000 0000** :\n
/// Indicate that caller want to reopen a file if its already open.
ADDON_READ_REOPEN = 0x100
ADDON_READ_REOPEN = 0x100,

/// @brief **0010 0000 0000** :\n
/// Indicate that caller want open a file without intermediate buffer regardless to file type.
ADDON_READ_NO_BUFFER = 0x200,
} OpenFileFlags;
///@}
//----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion xbmc/addons/kodi-dev-kit/include/kodi/versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define ADDON_GLOBAL_VERSION_AUDIOENGINE_DEPENDS "AudioEngine.h" \
"c-api/audio_engine.h"

#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.1.8"
#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.1.9"
#define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.1.7"
#define ADDON_GLOBAL_VERSION_FILESYSTEM_XML_ID "kodi.binary.global.filesystem"
#define ADDON_GLOBAL_VERSION_FILESYSTEM_DEPENDS "Filesystem.h" \
Expand Down
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_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
29 changes: 14 additions & 15 deletions xbmc/filesystem/IFileTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,38 @@ namespace XFILE
{

/* indicate that caller can handle truncated reads, where function returns before entire buffer has been filled */
static const unsigned int READ_TRUNCATED = 0x01;

/* indicate that that caller support read in the minimum defined chunk size, this disables internal cache then */
static const unsigned int READ_CHUNKED = 0x02;
static const unsigned int READ_TRUNCATED = 0x01;

/* use cache to access this file */
static const unsigned int READ_CACHED = 0x04;
static const unsigned int READ_CACHED = 0x04;

/* open without caching. regardless to file type. */
static const unsigned int READ_NO_CACHE = 0x08;
static const unsigned int READ_NO_CACHE = 0x08;

/* calculate bitrate for file while reading */
static const unsigned int READ_BITRATE = 0x10;
static const unsigned int READ_BITRATE = 0x10;

/* indicate to the caller we will seek between multiple streams in the file frequently */
static const unsigned int READ_MULTI_STREAM = 0x20;
static const unsigned int READ_MULTI_STREAM = 0x20;

/* indicate to the caller file is audio and/or video (and e.g. may grow) */
static const unsigned int READ_AUDIO_VIDEO = 0x40;
// Indicate to the caller file is audio and/or video and is suitable for caching with FileCache or StreamBuffer.
// The final method used will depend on the user's settings and file location, e.g. user can disable FileCache.
// This flag ensures that at least the buffer size necessary to read with the appropriate chunk size will be used.
static const unsigned int READ_AUDIO_VIDEO = 0x40;

/* indicate that caller will do write operations before reading */
static const unsigned int READ_AFTER_WRITE = 0x80;
static const unsigned int READ_AFTER_WRITE = 0x80;

/* indicate that caller want to reopen a file if its already open */
static const unsigned int READ_REOPEN = 0x100;
static const unsigned int READ_REOPEN = 0x100;

/* indicate that caller want open a file without intermediate buffer regardless to file type */
static const unsigned int READ_NO_BUFFER = 0x200;
static const unsigned int READ_NO_BUFFER = 0x200;

struct SNativeIoControl
{
unsigned long int request;
void* param;
unsigned long int request;
void* param;
};

struct SCacheStatus
Expand Down