lib: add libvlc_downloader API
On top of !3503 . First WIP commit to be reviewed there.
Context
The libvlc_downloader API provides a bitstream of media to client applications for storage and caching purposes. It supports asynchronous operation and reports download progress. Typical use cases include downloading network media files locally, caching support in medialibrary, etc. For more context, cf #27735
Constraints
- Currently supports only a limited set of protocols: http(s), ftp, file, nfs, smb, sftp.
- Only finite sized media is supported.
- Media is preparsed in the downloader, and downloading proceeds only for the libvlc_media_type_file type. Subitems and slave media (if present) are reported via callbacks for all types of media (playlist/directory).
- As discussed in #27735 , raw
vlc_access_NewMRLhas been used, and stream filter support hasn't been added.
Features:
- Asynchronous support using the
vlc_executorAPI. - Provides consumed media buffers to the caller.
- Allows the user to specify an optional output file path to a writable file.
- Reports download progress, state updates, subitems, and slave medias via callbacks.
- Cancellable download (currently uses
vlc_interrupt). - Allows toggling pause/resume for downloads. (Note: this only halts the corresponding thread; the paused download remains in the executor, since resubmitting a task to an executor is not supported).