|
VLC 4.0.0-dev
|
libvlc_downloader_t is an abstract representation of a downloader More...
Files | |
| file | libvlc_downloader.h |
| LibVLC downloader API. | |
Data Structures | |
| struct | libvlc_downloader_cbs |
| Downloader callbacks. More... | |
| struct | libvlc_downloader_request_t |
| struct defining a downloader request More... | |
| struct | libvlc_downloader_cfg |
| struct defining downloader configuration More... | |
Macros | |
| #define | LIBVLC_DOWNLOADER_CB_ERROR ((ptrdiff_t)-1) |
| Sentinel return value to signal an error in the download (to be returned by on_buffer callback). | |
| #define | LIBVLC_DOWNLOADER_CB_CANCEL ((ptrdiff_t)-2) |
| Sentinel return value to cancel the download (to be returned by on_buffer callback). | |
Typedefs | |
| typedef struct libvlc_downloader_t | libvlc_downloader_t |
| typedef struct libvlc_downloader_request_t | libvlc_downloader_request_t |
| A downloader request object. | |
| typedef struct libvlc_downloader_task | libvlc_downloader_task |
| Opaque handle of a downloader task. | |
| typedef enum libvlc_downloader_status_t | libvlc_downloader_status_t |
| Downloader status. | |
Enumerations | |
| enum | libvlc_downloader_status_t { libvlc_downloader_status_pending , libvlc_downloader_status_running , libvlc_downloader_status_paused , libvlc_downloader_status_finished , libvlc_downloader_status_cancelled , libvlc_downloader_status_error } |
| Downloader status. More... | |
libvlc_downloader_t is an abstract representation of a downloader
| #define LIBVLC_DOWNLOADER_CB_CANCEL ((ptrdiff_t)-2) |
Sentinel return value to cancel the download (to be returned by on_buffer callback).
| #define LIBVLC_DOWNLOADER_CB_ERROR ((ptrdiff_t)-1) |
Sentinel return value to signal an error in the download (to be returned by on_buffer callback).
| typedef struct libvlc_downloader_request_t libvlc_downloader_request_t |
A downloader request object.
| typedef enum libvlc_downloader_status_t libvlc_downloader_status_t |
Downloader status.
| typedef struct libvlc_downloader_t libvlc_downloader_t |
| typedef struct libvlc_downloader_task libvlc_downloader_task |
Opaque handle of a downloader task.
Identifies a task created by libvlc_downloader_task_new() and started with libvlc_downloader_submit(). It can be passed to libvlc_downloader_cancel() to cancel that request, or to libvlc_downloader_set_pause() to pause/resume that request.
Downloader status.
| size_t libvlc_downloader_cancel | ( | libvlc_downloader_t * | downloader, |
| libvlc_downloader_task * | task ) |
Cancel an ongoing download.
| downloader | downloader instance |
| task | a downloader task returned by libvlc_downloader_task_new(), or NULL to cancel all submitted requests. |
References LIBVLC_API.
| void libvlc_downloader_destroy | ( | libvlc_downloader_t * | downloader | ) |
Destroy a downloader and free resources.
All pending, running and paused downloads are cancelled. Waits for all download threads to join.
| downloader | downloader instance |
References LIBVLC_API.
| libvlc_downloader_t * libvlc_downloader_new | ( | libvlc_instance_t * | inst, |
| const struct libvlc_downloader_cfg * | cfg ) |
Create a downloader instance.
Supports downloading files over a limited set of protocols: http(s), ftp, file, nfs, smb, sftp
The downloader must be released by calling libvlc_downloader_destroy() when it is no longer needed.
| inst | LibVLC instance |
| cfg | a pointer to a valid downloader configuration struct |
References LIBVLC_API.
| void libvlc_downloader_set_pause | ( | libvlc_downloader_t * | downloader, |
| libvlc_downloader_task * | task, | ||
| bool | paused ) |
Toggle pause/resume for the download.
| downloader | downloader instance |
| task | a valid downloader task returned by libvlc_downloader_task_new() |
| paused | true to pause, false to resume |
Pausing a pending task (including one not submitted yet) does not pause parsing. The on_subitems and on_slaves callbacks are still invoked, if available. If the download starts, the paused state is reported before any data is read (without a prior running state), and nothing is downloaded until the task is resumed.
References LIBVLC_API.
| int libvlc_downloader_submit | ( | libvlc_downloader_t * | downloader, |
| libvlc_downloader_task * | task ) |
Start a task created by libvlc_downloader_task_new().
On success the task is scheduled and the callbacks are guaranteed to be called and the task will eventually report a terminal state (finished/cancelled/error). That callback may run even before this function returns.
| downloader | the downloader the task was created from |
| task | a task that has not yet been successfully submitted |
| libvlc_media_t * libvlc_downloader_task_get_media | ( | libvlc_downloader_task * | task | ) |
Get the media associated with the downloader request handle.
| task | opaque handle returned by libvlc_downloader_task_new() |
| libvlc_downloader_task * libvlc_downloader_task_new | ( | libvlc_downloader_t * | downloader, |
| const libvlc_downloader_request_t * | req, | ||
| const struct libvlc_downloader_cbs * | cbs, | ||
| void * | cbs_opaque ) |
Create a media download task.
This prepares a task handle for downloading a media. Nothing runs and no callback can fire until the handle is passed to libvlc_downloader_submit().
| downloader | downloader instance |
| req | a pointer to a valid request struct |
| cbs | a pointer to a valid callbacks struct. The pointed struct must be kept alive (and not modified) by the caller until libvlc_downloader_cbs.on_state_update() is called for the returned task handle with a terminal state (finished/cancelled/error). |
| cbs_opaque | opaque pointer for callbacks |
References LIBVLC_API.
| void libvlc_downloader_task_release | ( | libvlc_downloader_task * | task | ) |
Release a downloader task handle.
| task | the downloader task handle |
References LIBVLC_API.