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. |
|
Allocates a decoder instance. Security Warning: The Theora format supports very large frame sizes, potentially even larger than the address space of a 32-bit machine, and creating a decoder context allocates the space for several frames of data. If the allocation fails here, your program will crash, possibly at some future point because the OS kernel returned a valid memory range and will only fail when it tries to map the pages in it the first time they are used. Even if it succeeds, you may experience a denial of service if the frame size is large enough to cause excessive paging. If you are integrating libtheora in a larger application where such things are undesirable, it is highly recommended that you check the frame size in _info before calling this function and refuse to decode streams where it is larger than some reasonable maximum. libtheora will not check this for you, because there may be machines that can handle such streams and applications that wish to.
|
|
Decoder control function. This is used to provide advanced control of the decoding process.
|
|
Frees an allocated decoder instance.
|
|
Decodes the header packets of a Theora stream.
This should be called on the initial packets of the stream, in succession, until it returns
|
|
Submits a packet containing encoded video data to the decoder.
|
|
Outputs the next available frame of decoded Y'CbCr data. If a striped decode callback has been set with TH_DECCTL_SET_STRIPE_CB, then the application does not need to call this function.
|
|
Releases all storage used for the decoder setup information. This should be called after you no longer want to create any decoders for a stream whose headers you have parsed with th_decode_headerin().
|