#include <errno.h>
#include <stdarg.h>
#include "common.h"
#include "picture.h"
#include "data.h"
#include "version.h"
Go to the source code of this file.
#define DAV1D_MAX_FRAME_DELAY 256 |
#define DAV1D_MAX_THREADS 256 |
Enumerator |
---|
DAV1D_EVENT_FLAG_NEW_SEQUENCE |
The last returned picture contains a reference to a new Sequence Header, either because it's the start of a new coded sequence, or the decoder was flushed before it was generated.
|
DAV1D_EVENT_FLAG_NEW_OP_PARAMS_INFO |
The last returned picture contains a reference to a Sequence Header with new operating parameters information for the current coded sequence.
|
Enumerator |
---|
DAV1D_INLOOPFILTER_NONE |
|
DAV1D_INLOOPFILTER_DEBLOCK |
|
DAV1D_INLOOPFILTER_CDEF |
|
DAV1D_INLOOPFILTER_RESTORATION |
|
DAV1D_INLOOPFILTER_ALL |
|
Apply film grain to a previously decoded picture. If the picture contains no film grain metadata, then this function merely returns a new reference.
- Parameters
-
c | Input decoder instance. |
out | Output frame. The caller assumes ownership of the returned reference. |
in | Input frame. No ownership is transferred. |
- Returns
- 0: Success, and a frame is returned. other negative DAV1D_ERR codes: Error due to lack of memory or because of invalid passed-in arguments.
- Note
- If
Dav1dSettings.apply_grain
is true, film grain was already applied by dav1d_get_picture
, and so calling this function leads to double application of film grain. Users should only call this when needed.
Close a decoder instance and free all associated memory.
- Parameters
-
c_out | The decoder instance to close. *c_out will be set to NULL. |
Initialize settings to default values.
- Parameters
-
Flush all delayed frames in decoder and clear internal decoder state, to be used when seeking.
- Parameters
-
- Note
- Decoding will start only after a valid sequence header OBU is delivered to dav1d_send_data().
Retrieve the user-provided metadata associated with the input data packet for the last decoding error reported to the user, i.e. a negative return value (not EAGAIN) from dav1d_send_data() or dav1d_get_picture().
- Parameters
-
c | Input decoder instance. |
out | Output Dav1dDataProps. On success, the caller assumes ownership of the returned reference. |
- Returns
- 0 on success, or < 0 (a negative DAV1D_ERR code) on error.
Fetch a combination of DAV1D_EVENT_FLAG_* event flags generated by the decoding process.
- Parameters
-
c | Input decoder instance. |
flags | Where to write the flags. |
- Returns
- 0 on success, or < 0 (a negative DAV1D_ERR code) on error.
- Note
- Calling this function will clear all the event flags currently stored in the decoder.
Return a decoded picture.
- Parameters
-
c | Input decoder instance. |
out | Output frame. The caller assumes ownership of the returned reference. |
- Returns
- 0: Success, and a frame is returned. DAV1D_ERR(EAGAIN): Not enough data to output a frame. dav1d_send_data() should be called with new input. other negative DAV1D_ERR codes: Error during decoding or because of invalid passed-in arguments.
- Note
- To drain buffered frames from the decoder (i.e. on end of stream), call this function until it returns DAV1D_ERR(EAGAIN).
int res;
read_data(&data);
do {
packet. It eventually will after one or more frames have been
returned in this loop.
free_and_abort();
if (res < 0) {
free_and_abort();
} else
output_and_unref_picture(&p);
}
while (data.
sz || read_data(&data) == SUCCESS);
do {
if (res < 0) {
free_and_abort();
} else
output_and_unref_picture(&p);
} while (res == 0);
Allocate and open a decoder instance.
- Parameters
-
c_out | The decoder instance to open. *c_out will be set to the allocated context. |
s | Input settings context. |
- Note
- The context must be freed using dav1d_close() when decoding is finished.
- Returns
- 0 on success, or < 0 (a negative DAV1D_ERR code) on error.
Parse a Sequence Header OBU from bitstream data.
- Parameters
-
out | Output Sequence Header. |
buf | The data to be parser. |
sz | Size of the data. |
- Returns
- 0: Success, and out is filled with the parsed Sequence Header OBU parameters. DAV1D_ERR(ENOENT): No Sequence Header OBUs were found in the buffer. other negative DAV1D_ERR codes: Invalid data in the buffer, invalid passed-in arguments, and other errors during parsing.
- Note
- It is safe to feed this function data containing other OBUs than a Sequence Header, as they will simply be ignored. If there is more than one Sequence Header OBU present, only the last will be returned.
Feed bitstream data to the decoder.
- Parameters
-
c | Input decoder instance. |
in | Input bitstream data. On success, ownership of the reference is passed to the library. |
- Returns
- 0: Success, and the data was consumed. DAV1D_ERR(EAGAIN): The data can't be consumed. dav1d_get_picture() should be called to get one or more frames before the function can consume new data. other negative DAV1D_ERR codes: Error during decoding or because of invalid passed-in arguments.