|
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.
|
Decodes the header packets of a Theora stream.
This should be called on the initial packets of the stream, in succession, until it returns 0
, indicating that all headers have been processed, or an error is encountered. At least three header packets are required, and additional optional header packets may follow. This can be used on the first packet of any logical stream to determine if that stream is a Theora stream.
- Parameters:
-
| _info | A th_info structure to fill in. This must have been previously initialized with th_info_init(). The application may immediately begin using the contents of this structure after the first header is decoded, though it must continue to be passed in on all subsequent calls. |
| _tc | A th_comment structure to fill in. The application may immediately begin using the contents of this structure after the second header is decoded, though it must continue to be passed in on all subsequent calls. |
| _setup | Returns a pointer to additional, private setup information needed by the decoder. The contents of this pointer must be initialized to NULL on the first call, and the returned value must continue to be passed in on all subsequent calls. |
| _op | An ogg_packet structure which contains one of the initial packets of an Ogg logical stream. |
- Returns:
- A positive value indicates that a Theora header was successfully processed.
- Return values:
-
| 0 | The first video data packet was encountered after all required header packets were parsed. The packet just passed in on this call should be saved and fed to th_decode_packetin() to begin decoding video data. |
| TH_EFAULT | One of _info, _tc, or _setup was NULL . |
| TH_EBADHEADER | _op was NULL , the packet was not the next header packet in the expected sequence, or the format of the header data was invalid. |
| TH_EVERSION | The packet data was a Theora info header, but for a bitstream version not decodable with this version of libtheoradec . |
| TH_ENOTFORMAT | The packet was not a Theora header. |