dav1d
Data Structures | Functions
data.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "common.h"

Go to the source code of this file.

Data Structures

struct  Dav1dData
 

Functions

DAV1D_API uint8_t * dav1d_data_create (Dav1dData *data, size_t sz)
 
DAV1D_API int dav1d_data_wrap (Dav1dData *data, const uint8_t *buf, size_t sz, void(*free_callback)(const uint8_t *buf, void *user_data), void *user_data)
 
DAV1D_API void dav1d_data_unref (Dav1dData *data)
 

Function Documentation

◆ dav1d_data_create()

DAV1D_API uint8_t* dav1d_data_create ( Dav1dData data,
size_t  sz 
)

Allocate data.

Parameters
dataInput context.
szSize of the data that should be allocated.
Returns
Pointer to the allocated buffer on success. NULL on error.

◆ dav1d_data_unref()

DAV1D_API void dav1d_data_unref ( Dav1dData data)

Free the data reference.

Parameters
dataInput context.

◆ dav1d_data_wrap()

DAV1D_API int dav1d_data_wrap ( Dav1dData data,
const uint8_t *  buf,
size_t  sz,
void(*)(const uint8_t *buf, void *user_data)  free_callback,
void *  user_data 
)

Wrap an existing data array.

Parameters
dataInput context.
bufThe data to be wrapped.
szSize of the data.
free_callbackFunction to be called when we release our last reference to this data. In this callback, $buf will be the $buf argument to this function, and $user_data will be the $user_data input argument to this function.
user_dataOpaque parameter passed to free_callback().
Returns
0 on success. A negative errno value on error.