Vigith Maurice > Ogg-Theora-LibTheora-0.04 > LibTheora.xs

Download:
Ogg-Theora-LibTheora-0.04.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

Functions (malloc) ^

http://www.theora.org/doc/libtheora-1.0/annotated.html

make_th_info

Creates a memory allocation for th_info.

-Input: Void

-Output: Memory Pointer

make_th_huff_code

Creates a memory allocation for th_huff_code.

-Input: void

-Output: Memory Pointer

make_th_img_plane

Creates a memory allocation for th_img_plane.

-Input: void

-Output: Memory Pointer

make_th_quant_info

Creates a memory allocation for th_quant_info.

-Input: void

-Output: Memory Pointer

make_th_quant_ranges

Creates a memory allocation for th_quant_ranges.

-Input: void

-Output: Memory Pointer

make_th_stripe_callback

Creates a memory allocation for th_stripe_callback.

-Input: void

-Output: Memory Pointer

make_th_ycbcr_buffer

Creates a memory allocation for th_ycbcr_buffer.

-Input: void

-Output: Memory Pointer

make_th_comment

Creates a memory allocation for th_comment.

-Input: void

-Output: Memory Pointer

Functions (Basic shared functions) ^

http://www.theora.org/doc/libtheora-1.0/group__basefuncs.html

th_version_number

Retrieves the library version number.

-Input: void

-Output: ogg_uint32_t (IV)

th_version_string

Retrieves a human-readable string to identify the library vendor and version.

-Input: void

-Output: const char * (T_PV)

th_packet_isheader

Determines whether a Theora packet is a header or not.

-Input: _op An ogg_packet containing encoded Theora data.

-Output: 1 packet is a header packet, 0 packet is a video data packet.

th_granule_frame

Converts a granule position to an absolute frame index, starting at 0.

-Input: void * _encdec (previously allocated th_enc_ctx or th_dec_ctx handle), ogg_int64_t _granpos (granule position to convert).

-Output: absolute frame index corresponding to _granpos, -1 on error.

th_granule_time

Converts a granule position to an absolute time in seconds.

-Input: void * _encdec (previously allocated th_enc_ctx or th_dec_ctx handle), ogg_int64_t _granpos (granule position to convert).

-Output: absolute time in seconds corresponding to _granpos, -1 on error.

th_packet_iskeyframe

Determines whether a theora packet is a key frame or not.

-Input: _op An ogg_packet containing encoded Theora data.

-Output: 1 packet is a key frame, 0 packet is a delta frame, -1 packet is not a video data packet.

Functions (Manipulating Header Data) ^

th_comment_init

Initialize a th_comment structure.

-Input: th_comment *

-Output: void

th_info_init

Initializes a th_info structure.

-Input: th_info

-Output: void

th_info_clear

Clears a th_info structure.

-Input: th_info

-Output: void

th_comment_add

Add a comment to an initialized th_comment structure.

-Input: th_comment, char * (null-terminated UTF-8 string containing the comment in "TAG=the value" form).

-Output: void

th_comment_add_tag

Add a comment to an initialized th_comment structure.

-Input: th_comment, char * (null-terminated string containing the tag associated with the comment), char * (corresponding value as a null-terminated string).

th_comment_query_count

Look up the number of instances of a tag.

-Input: th_comment, char * (tag to look up).

-Output: int (number on instances of this particular tag)

th_comment_query

Look up a comment value by its tag.

-Input: th_comment, char * (tag to look-up) int (instance of the tag, it starts from 0)

-Output: char * if matched pointer to the queried tag's value, NULL if no matching tag is found

Functions (For Decoding) ^

http://www.theora.org/doc/libtheora-1.0/group__decfuncs.html

th_decode_headerin

Decodes the header packets of a Theora stream.

-Input: th_info, th_comment, th_setup_info, (initialized to NULL on the first call & returned value be passed on subsequent calls) ogg_packet

-Output: 0 first video data packet was encountered after all required header packets were parsed, TH_EFAULT if one of _info, _tc, or _setup was NULL, TH_EBADHEADER _op was NULL, TH_EVERSION not decodable with current libtheoradec version, TH_ENOTFORMAT not a Theora header

th_decode_alloc

Allocates a decoder instance.

-Input: th_info, th_setup_info

-Output: th_dec_ctx

th_setup_free

Releases all storage used for the decoder setup information.

-Input: th_setup_info

-Output: void

th_decode_packetin

Submits a packet containing encoded video data to the decoder.

-Input: th_dec_ctx, ogg_packet, ogg_int64_t gran_pos, returns the granule position of the decoded packet

-Output: 0 success, TH_DUPFRAME packet represented a dropped (0-byte) frame, TH_EFAULT _dec or _op was NULL, TH_EBADPACKET _op does not contain encoded video data, TH_EIMPL video data uses bitstream features which this library does not support.

th_decode_ycbcr_out

Outputs the next available frame of decoded Y'CbCr data.

-Input: th_dec_ctx, th_ycbcr_buffer (video buffer structure to fill in)

-Output: 0 Success

th_decode_free

Frees an allocated decoder instance.

-Input: th_dec_ctx

-Output: void

th_decode_ctl

Decoder control function. (i haven't tested this)

-Input: th_dec_ctx, int _req (control code to process), void * _buf (parameters for this control code), size_t _buf_sz (size of the parameter buffer)

-Output: int (not documented)

Functions (for Encoding) ^

http://www.theora.org/doc/libtheora-1.0/group__encfuncs.html

th_encode_alloc

Allocates an encoder instance.

-Input: th_info.

-Output: th_enc_ctx handle, NULL (if the encoding parameters were invalid).

th_encode_flushheader

-Input: th_enc_ctx, th_comment, ogg_packet.

-Output: > 1 (indicates that a header packet was successfully produced), 0 (no packet was produced, and no more header packets remain), TH_EFAULT (_enc, _comments, or _op was NULL).

th_encode_ycbcr_in

Submits an uncompressed frame to the encoder. (if you don't have ycbcr buffer you can try using the *unoptimized* rgb_th_encode_ycbcr_in, better you write your own).

-Input: th_enc_ctx, th_ycbcr_buffer

-Output: 0 Success, TH_EFAULT _enc or _ycbcr is NULL, TH_EINVAL buffer size does not match the frame size encoder was initialized.

th_encode_packetout

Retrieves encoded video data packets.

-Input: th_enc_ctx, int (non-zero value if no more uncompressed frames will be submitted), ogg_packet.

-Output: > 0 a video data packet was successfully produced, 0 no packet was produced, and no more encoded video data remains, TH_EFAULT _enc or _op was NULL.

th_encode_free

Frees an allocated encoder instance.

-Input: th_enc_ctx

-Output: void

Miscellaneous Functions ^

These functions are not found in libtheora*, but is written by the XS author to simplify few tasks.

get_th_info

Returns a HashRef with th_info struct values.

-Input: th_info

-Output: HashRef

ycbcr_to_rgb_buffer

reads the data from the ycbcr buffer and converts to its equivalent rgb buffer. (this is NOT an optimized code, there will be better ycbcr to rgb convertors, some intel gpu processors have mnemonic that does the conversion)

-Input: th_ycbcr_buffer

-Output: RGB string

get_th_comment

return an array of comments

-Input: th_comment

-Output: array of comments

set_th_info

sets the th_info structure to default values unless specified in hash. frame_width and frame_height is mandatory.

-Input: Hash of elements

-Output: void

rgb_th_encode_ycbcr_in

Converts a rgb to ycbcr buffer. (this is not an optimized code)

-Input: th_enc_ctx char * (rgb string), width, height.

-Output: th_ycbcr_buffer

get_th_ycbcr_buffer_info

Returns an arrayref of hashrefs containing width, height, stride and data_pointer for each plane (issue#1)

-Input: th_ycbcr_buffer

-Output: arrayref

get_th_ycbcr_buffer_ptr

Returns an data pointer for specified plane index (0 - Y, 1 - Cb, 2 - Cr)

-Input: th_ycbcr_buffer index

-Output: pointer

get_th_ycbcr_buffer_data

Returns an data for specified plane index (0 - Y, 1 - Cb, 2 - Cr)

-Input: th_ycbcr_buffer index

-Output: string

syntax highlighting: