VLC 4.0.0-dev
Loading...
Searching...
No Matches
libvlc_downloader_cbs Struct Reference

Downloader callbacks. More...

#include <libvlc_downloader.h>

Data Fields

uint32_t version
 Version of struct libvlc_downloader_cbs.
ptrdiff_t(* on_buffer )(void *opaque, libvlc_downloader_task *task, const uint8_t *buf, size_t len, uint64_t position, uint64_t total)
 Called when a buffer of data is read.
void(* on_state_update )(void *opaque, libvlc_downloader_task *task, libvlc_downloader_status_t status)
 Called when the downloader state changes.
void(* on_subitems )(void *opaque, libvlc_downloader_task *task, libvlc_media_list_t *subitems)
 Called when subitems of the media are available.
void(* on_slaves )(void *opaque, libvlc_downloader_task *task, libvlc_media_slave_t **slaves, size_t count)
 Called when the parsed media has slaves.

Detailed Description

Downloader callbacks.

Field Documentation

◆ on_buffer

ptrdiff_t(* libvlc_downloader_cbs::on_buffer) (void *opaque, libvlc_downloader_task *task, const uint8_t *buf, size_t len, uint64_t position, uint64_t total)

Called when a buffer of data is read.

Note
Mandatory (can't be NULL), available since version 0
Warning
Do not call any libvlc_downloader_* API from within this callback. Only libvlc_downloader_task_* APIs may be called on the provided task handle. And avoid blocking operations in this callback as it is invoked with the internal lock held.
Parameters
opaqueuser data
taskopaque handle returned by libvlc_downloader_queue()
bufpointer to buffer (owned by downloader, only valid during callback)
lensize of buffer
positiontotal number of bytes read by the downloader so far
totaltotal size of the media in bytes (only medias with finite size are allowed to download)
Returns
The number of bytes consumed by the user, or LIBVLC_DOWNLOADER_CB_ERROR to terminate the download with an error, or LIBVLC_DOWNLOADER_CB_CANCEL to cancel the download.

If the returned number of bytes consumed is less than len (partial read), the downloader auto-pauses as a form of backpressure. The user must call libvlc_downloader_set_pause(dl, task, false) from the main thread to resume when ready to consume data again.

Note
User must copy the data if it needs to be accessed later. The maximum buffer size is limited to around 64 KB.

◆ on_slaves

void(* libvlc_downloader_cbs::on_slaves) (void *opaque, libvlc_downloader_task *task, libvlc_media_slave_t **slaves, size_t count)

Called when the parsed media has slaves.

Note
Optional (can be NULL), available since version 0
Parameters
opaqueuser data
taskopaque handle returned by libvlc_downloader_queue()
slavesarray of libvlc_media_slave_t* (owned by LibVLC)
countnumber of slaves

◆ on_state_update

void(* libvlc_downloader_cbs::on_state_update) (void *opaque, libvlc_downloader_task *task, libvlc_downloader_status_t status)

Called when the downloader state changes.

Note
Mandatory (can't be NULL), available since version 0

Invoked when download starts, pauses, resumes, cancels, finishes or errors out. libvlc_downloader_status_t

Warning
Do not call any libvlc_downloader_* API from within this callback. Only libvlc_downloader_task_* APIs may be called on the provided task handle. And avoid blocking operations in this callback as it is invoked with the internal lock held.
Parameters
opaqueuser data
taskopaque handle returned by libvlc_downloader_queue()
statusdownload status

◆ on_subitems

void(* libvlc_downloader_cbs::on_subitems) (void *opaque, libvlc_downloader_task *task, libvlc_media_list_t *subitems)

Called when subitems of the media are available.

Note
Optional (can be NULL), available since version 0
Parameters
opaqueuser data
taskopaque handle returned by libvlc_downloader_queue()
subitemsmedia list of subitems (owned by LibVLC)

◆ version

uint32_t libvlc_downloader_cbs::version

Version of struct libvlc_downloader_cbs.


The documentation for this struct was generated from the following file: