From b7e5c897fb8cf666606836cbe05a624ba426fde7 Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Tue, 7 May 2024 18:39:37 +0200 Subject: [PATCH] [FileSystem] Update read flags documentation --- xbmc/addons/interfaces/Filesystem.cpp | 4 +-- .../include/kodi/c-api/filesystem.h | 14 +++++++-- .../kodi-dev-kit/include/kodi/versions.h | 2 +- xbmc/filesystem/IFileTypes.h | 29 +++++++++---------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/xbmc/addons/interfaces/Filesystem.cpp b/xbmc/addons/interfaces/Filesystem.cpp index 9f22b67ecce0b..95023d83be8fd 100644 --- a/xbmc/addons/interfaces/Filesystem.cpp +++ b/xbmc/addons/interfaces/Filesystem.cpp @@ -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) @@ -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; } diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/filesystem.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/filesystem.h index aedcf6434e378..3a17f036ec4d3 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/filesystem.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/filesystem.h @@ -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 @@ -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 @@ -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; ///@} //---------------------------------------------------------------------------- diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-dev-kit/include/kodi/versions.h index 1eae8133fbb6a..fc340f3bd85b7 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/versions.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/versions.h @@ -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" \ diff --git a/xbmc/filesystem/IFileTypes.h b/xbmc/filesystem/IFileTypes.h index 1f89350cc9d0c..81e80fa41ed67 100644 --- a/xbmc/filesystem/IFileTypes.h +++ b/xbmc/filesystem/IFileTypes.h @@ -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