libtheoradec
C decoding API. More...
#include <stddef.h>
#include <ogg/ogg.h>
#include "codec.h"
Go to the source code of this file.
Data Structures | |
struct | th_stripe_callback |
The striped decode callback data to pass to TH_DECCTL_SET_STRIPE_CB. More... | |
th_decode_ctl() codes | |
These are the available request codes for th_decode_ctl(). By convention, these are odd, to distinguish them from the encoder control codes. Keep any experimental or vendor-specific values above 0x8000 . | |
#define | TH_DECCTL_GET_PPLEVEL_MAX (1) |
Gets the maximum post-processing level. | |
#define | TH_DECCTL_SET_PPLEVEL (3) |
Sets the post-processing level. | |
#define | TH_DECCTL_SET_GRANPOS (5) |
Sets the granule position. | |
#define | TH_DECCTL_SET_STRIPE_CB (7) |
Sets the striped decode callback function. | |
Decoder state | |
The following data structures are opaque, and their contents are not publicly defined by this API. Referring to their internals directly is unsupported, and may break without warning. | |
typedef th_dec_ctx | th_dec_ctx |
The decoder context. | |
typedef th_setup_info | th_setup_info |
Setup information. | |
Functions for decoding | |
You must link to libtheoradec if you use any of the functions in this section.The functions are listed in the order they are used in a typical decode. The basic steps are:
| |
int | th_decode_headerin (th_info *_info, th_comment *_tc, th_setup_info **_setup, ogg_packet *_op) |
Decodes the header packets of a Theora stream. | |
th_dec_ctx * | th_decode_alloc (const th_info *_info, const th_setup_info *_setup) |
Allocates a decoder instance. | |
void | th_setup_free (th_setup_info *_setup) |
Releases all storage used for the decoder setup information. | |
int | th_decode_ctl (th_dec_ctx *_dec, int _req, void *_buf, size_t _buf_sz) |
Decoder control function. | |
int | th_decode_packetin (th_dec_ctx *_dec, const ogg_packet *_op, ogg_int64_t *_granpos) |
Submits a packet containing encoded video data to the decoder. | |
int | th_decode_ycbcr_out (th_dec_ctx *_dec, th_ycbcr_buffer _ycbcr) |
Outputs the next available frame of decoded Y'CbCr data. | |
void | th_decode_free (th_dec_ctx *_dec) |
Frees an allocated decoder instance. | |
Defines | |
#define | _O_THEORA_THEORADEC_H_ (1) |
Typedefs | |
typedef void(* | th_stripe_decoded_func )(void *_ctx, th_ycbcr_buffer _buf, int _yfrag0, int _yfrag_end) |
A callback function for striped decode. |
libtheoradec
C decoding API.
|
|
|
Gets the maximum post-processing level.
|
|
Sets the granule position. Call this after a seek, before decoding the first frame, to ensure that the proper granule position is returned for all subsequent frames. If you track timestamps yourself and do not use the granule position returned by the decoder, then you need not call this function.
|
|
Sets the post-processing level. By default, post-processing is disabled.
|
|
Sets the striped decode callback function.
If set, this function will be called as each piece of a frame is fully decoded in th_decode_packetin(). You can pass in a th_stripe_callback with th_stripe_callback::stripe_decoded set to
|
|
The decoder context.
|
|
Setup information. This contains auxiliary information (Huffman tables and quantization parameters) decoded from the setup header by th_decode_headerin() to be passed to th_decode_alloc(). It can be re-used to initialize any number of decoders, and can be freed via th_setup_free() at any time. |
|
A callback function for striped decode.
This is a function pointer to an application-provided function that will be called each time a section of the image is fully decoded in th_decode_packetin(). This allows the application to process the section immediately, while it is still in cache. Note that the frame is decoded bottom to top, so _yfrag0 will steadily decrease with each call until it reaches 0, at which point the full frame is decoded. The number of fragment rows made available in each call depends on the pixel format and the number of post-processing filters enabled, and may not even be constant for the entire frame. If a non-
|