Skip to content

Support Kodi VFS resources - #2107

Open
garbear wants to merge 3 commits into
xbmc:Piersfrom
garbear:add-vfs
Open

Support Kodi VFS resources#2107
garbear wants to merge 3 commits into
xbmc:Piersfrom
garbear:add-vfs

Conversation

@garbear

@garbear garbear commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Allow adaptive resources to be read through Kodi's VFS in addition to HTTP(S). Because I want to play file::// URLs.

AI use:

Extend URL resolution to support Kodi VFS schemes, including file:// URLs and URNs (such as potential v23 magnet: links in xbmc/xbmc#23696) across nested playlist, init and segment URLs.

Extend CUrl so HTTP(S) keeps the existing CURL path while other schemes use kodi::vfs::CFile. Byte ranges use the existing HTTP Range header for HTTP(S), or seek and bounded reads for VFS resources.

Update adaptive segment downloads to use the transport-independent range handling.

Motivation and context

InputStream Adaptive currently opens adaptive resources through Kodi's CURL interface, which limits playback to HTTP(S)-style resources.

This allows manifests and their referenced resources to be loaded from Kodi VFS URLs such as file://, and enables VFS providers such as Kodi's magnet: filesystem to be used by InputStream Adaptive without adding transport-specific code to the add-on.

How has this been tested?

Tested on macOS ARM64 with Kodi 22 development builds.

  • Added tests for generic URI detection and nested VFS URL resolution, including preservation of magnet query identity.
  • Added tests for local VFS reads, bounded and open-ended byte ranges, EOF handling, failed seeks, and preservation of the existing HTTP path.
  • Added adaptive-stream tests for VFS byte ranges and stopped downloads.
  • Full InputStream Adaptive test suite passes: 83/83.
  • Tested end-to-end with a local CMAF/HLS presentation using file://.
  • Kodi loaded the modified InputStream Adaptive add-on, opened the master and child playlists, initialization fragments and media segments, decoded 3840x2160 H.264 with E-AC-3 Atmos audio, and played the approximately 20-second presentation to normal EOF.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

@phunkyfish
phunkyfish requested a review from CastagnaIT August 27, 2026 19:32
Comment thread src/utils/CurlUtils.cpp
int UTILS::CURL::CUrl::Open()
{
if (!m_file.CURLOpen(ADDON_READ_NO_CACHE | ADDON_READ_NO_BUFFER))
if (m_isHttp)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to have something like m_isVfs instead of m_isHttp so that its more clear that code is for VFS protocols (here and in all other code changes)

Comment thread src/utils/CurlUtils.cpp
double UTILS::CURL::CUrl::GetDownloadSpeed()
{
return m_file.GetFileDownloadSpeed();
return m_isHttp ? m_file.GetFileDownloadSpeed() : 0.0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, if we don't have information about the download speed,
this will make it impossible to manage automatically the stream quality in "adaptive" streams
this should be documented, more likely on Wiki

It will need to be documented that also headers cannot be handled either,
they are usually important for most streaming services
I’m not familiar with VFS protocols, but i imagine that VFS sources are custom streams (?) and don’t require http headers but it’s best to point this out also this one on Wiki

@garbear garbear Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see what we can do about download speed. I only tested with file:// URLs, in which case download speed isn't really an issue. So VFS support was initially for testing. But I want to use it with magnet:?xt=urn:btih:... URNs as well. Later I'll research this use case more, and come back with changes.

@CastagnaIT CastagnaIT added Type: Feature non-breaking change which adds functionality v23 Q* labels Aug 29, 2026
@CastagnaIT

Copy link
Copy Markdown
Collaborator

I've just taken a quick look
I'll review in the coming weeks since there's no rush with this feature

@garbear

garbear commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

I'll review in the coming weeks since there's no rush with this feature

No rush, my ultimate use case is to combine this with xbmc/xbmc#23696, which definitely isn't a v22 feature and far from being done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature non-breaking change which adds functionality v23 Q*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants