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

struct defining callbacks for libvlc_media_new_callbacks() More...

#include <libvlc_media.h>

Data Fields

uint32_t version
 Version of struct libvlc_media_open_cbs.
int(* open )(void *cbs_opaque, void **datap, uint64_t *sizep)
 Callback prototype to open a custom bitstream input media.
ptrdiff_t(* read )(void *data, unsigned char *buf, size_t len)
 Callback prototype to read data from a custom bitstream input media.
int(* seek )(void *data, uint64_t offset)
 Callback prototype to seek a custom bitstream input media.
void(* close )(void *data)
 Callback prototype to close a custom bitstream input media.

Detailed Description

struct defining callbacks for libvlc_media_new_callbacks()

Field Documentation

◆ close

void(* libvlc_media_open_cbs::close) (void *data)

Callback prototype to close a custom bitstream input media.

Note
Optional (can be NULL), available since version 0
Parameters
dataprivate pointer as set by the open callback

◆ open

int(* libvlc_media_open_cbs::open) (void *cbs_opaque, void **datap, uint64_t *sizep)

Callback prototype to open a custom bitstream input media.

The same media item can be opened multiple times. Each time, this callback is invoked. It should allocate and initialize any instance-specific resources, then store them in *datap. The instance resources can be freed in the close callback.

Parameters
cbs_opaqueprivate pointer as passed to libvlc_media_new_callbacks()
datapstorage space for a private data pointer [OUT]
sizepbyte length of the bitstream or UINT64_MAX if unknown [OUT]
Note
For convenience, *datap is initially NULL and *sizep is initially 0.
Optional (can be NULL), available since version 0
If NULL, the opaque pointer will be passed to read_cb, seek_cb and close_cb, and the stream size will be treated as unknown.
Returns
0 on success, non-zero on error. In case of failure, the other callbacks will not be invoked and any value stored in *datap and *sizep is discarded.

◆ read

ptrdiff_t(* libvlc_media_open_cbs::read) (void *data, unsigned char *buf, size_t len)

Callback prototype to read data from a custom bitstream input media.

Parameters
dataprivate pointer as set by the open callback
bufstart address of the buffer to read data into
lenbytes length of the buffer
Note
Mandatory (can't be NULL), available since version 0
Returns
strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error
Note
If no data is immediately available, then the callback should sleep.
Warning
The application is responsible for avoiding deadlock situations.

◆ seek

int(* libvlc_media_open_cbs::seek) (void *data, uint64_t offset)

Callback prototype to seek a custom bitstream input media.

Note
Optional (can be NULL if seeking is not supported), available since version 0
Parameters
dataprivate pointer as set by the open callback
offsetabsolute byte offset to seek to
Returns
0 on success, -1 on error.

◆ version

uint32_t libvlc_media_open_cbs::version

Version of struct libvlc_media_open_cbs.


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