paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Fields
mp4_callback Struct Reference

Callbacks provided by the user of the mp4 parsing API. More...

#include <mp4.h>

Data Fields

void * user_data
 This pointer is propagated to each call of all methods. More...
 
ssize_t(* read )(void *user_data, void *buffer, size_t length)
 This should return the number of bytes read on success. More...
 
off_t(* seek )(void *user_data, off_t offset, int whence)
 This method is assumed to succeed. More...
 
ssize_t(* write )(void *user_data, void *buffer, size_t count)
 Like the write() system call, this should return the number of bytes written. More...
 
int(* truncate )(void *user_data)
 Unlike the truncate system call, this function does not receive an offset. More...
 

Detailed Description

Callbacks provided by the user of the mp4 parsing API.

A pointer to this structure is passed to the two public open functions. If the file is opened in read-only mode, the ->write() and ->truncate() methods won't be called and may thus be NULL. The ->read() and ->seek() methods must be supplied for either open type.

All methods are supposed to work like their corresponding system calls. That is, they should return non-negative for success and -1 on failure. In the error case errno is expected to be set accordingly.

See also
mp4_open(), mp4_open_meta().

Field Documentation

◆ user_data

void* user_data

This pointer is propagated to each call of all methods.

◆ read

ssize_t(* read) (void *user_data, void *buffer, size_t length)

This should return the number of bytes read on success.

Short reads are OK: the function may return less than length.

◆ seek

off_t(* seek) (void *user_data, off_t offset, int whence)

This method is assumed to succeed.

The implementation should simply abort on errors. Note that offsets beyond EOF must not be regarded as invalid arguments.

◆ write

ssize_t(* write) (void *user_data, void *buffer, size_t count)

Like the write() system call, this should return the number of bytes written.

Short writes are OK: the function may return less than count.

◆ truncate

int(* truncate) (void *user_data)

Unlike the truncate system call, this function does not receive an offset.

The method is expected to truncate the file to the offset given by the current file position instead.


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