Crate theorafile_rs

source ·

Structs§

Constants§

Functions§

  • Add a comment to an initialized #th_comment structure. \note Neither th_comment_add() nor th_comment_add_tag() support comments containing null values, although the bitstream format does support them. To add such comments you will need to manipulate the #th_comment structure directly. \param _tc The #th_comment struct to add the comment to. \param _comment Must be a null-terminated UTF-8 string containing the comment in “TAG=the value” form.
  • Add a comment to an initialized #th_comment structure. \note Neither th_comment_add() nor th_comment_add_tag() support comments containing null values, although the bitstream format does support them. To add such comments you will need to manipulate the #th_comment structure directly. \param _tc The #th_comment struct to add the comment to. \param _tag A null-terminated string containing the tag associated with the comment. \param _val The corresponding value as a null-terminated string.
  • Clears a #th_comment structure. This should be called on a #th_comment structure after it is no longer needed. It will free all memory used by the structure members. \param _tc The #th_comment struct to clear.
  • Initialize a #th_comment structure. This should be called on a freshly allocated #th_comment structure before attempting to use it. \param _tc The #th_comment struct to initialize.
  • Look up a comment value by its tag. \param _tc An initialized #th_comment structure. \param _tag The tag to look up. \param _count The instance of the tag. The same tag can appear multiple times, each with a distinct value, so an index is required to retrieve them all. The order in which these values appear is significant and should be preserved. Use th_comment_query_count() to get the legal range for the \a _count parameter. \return A pointer to the queried tag’s value. This points directly to data in the #th_comment structure. It should not be modified or freed by the application, and modifications to the structure may invalidate the pointer. \retval NULL If no matching tag is found.
  • Look up the number of instances of a tag. Call this first when querying for a specific tag and then iterate over the number of instances with separate calls to th_comment_query() to retrieve all the values for that tag in order. \param _tc An initialized #th_comment structure. \param _tag The tag to look up. \return The number of instances of this particular tag.
  • Allocates a decoder instance.
  • Decoder control function. This is used to provide advanced control of the decoding process. \param _dec A #th_dec_ctx handle. \param _req The control code to process. See \ref decctlcodes “the list of available control codes” for details. \param _buf The parameters for this control code. \param _buf_sz The size of the parameter buffer. \return Possible return values depend on the control code used. See \ref decctlcodes “the list of control codes” for specific values. Generally 0 indicates success.
  • Frees an allocated decoder instance. \param _dec A #th_dec_ctx handle.
  • 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. \param _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. \param _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. \param _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. \param _op An ogg_packet structure which contains one of the initial packets of an Ogg logical stream. \return A positive value indicates that a Theora header was successfully processed. \retval 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. \retval TH_EFAULT One of \a _info, \a _tc, or \a _setup was NULL. \retval TH_EBADHEADER \a _op was NULL, the packet was not the next header packet in the expected sequence, or the format of the header data was invalid. \retval TH_EVERSION The packet data was a Theora info header, but for a bitstream version not decodable with this version of libtheoradec. \retval TH_ENOTFORMAT The packet was not a Theora header.
  • Submits a packet containing encoded video data to the decoder. \param _dec A #th_dec_ctx handle. \param _op An ogg_packet containing encoded video data. \param _granpos Returns the granule position of the decoded packet. If non-NULL, the granule position for this specific packet is stored in this location. This is computed incrementally from previously decoded packets. After a seek, the correct granule position must be set via #TH_DECCTL_SET_GRANPOS for this to work properly. \retval 0 Success. A new decoded frame can be retrieved by calling th_decode_ycbcr_out(). \retval TH_DUPFRAME The packet represented a dropped frame (either a 0-byte frame or an INTER frame with no coded blocks). The player can skip the call to th_decode_ycbcr_out(), as the contents of the decoded frame buffer have not changed. \retval TH_EFAULT \a _dec or \a _op was NULL. \retval TH_EBADPACKET \a _op does not contain encoded video data. \retval TH_EIMPL The video data uses bitstream features which this library does not support.
  • 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. \param _dec A #th_dec_ctx handle. \param _ycbcr A video buffer structure to fill in. libtheoradec will fill in all the members of this structure, including the pointers to the uncompressed video data. The memory for this video data is owned by libtheoradec. It may be freed or overwritten without notification when subsequent frames are decoded. \retval 0 Success \retval TH_EFAULT \a _dec or \a _ycbcr was NULL.
  • Converts a granule position to an absolute frame index, starting at 0. The granule position is interpreted in the context of a given #th_enc_ctx or #th_dec_ctx handle (either will suffice). \param _encdec A previously allocated #th_enc_ctx or #th_dec_ctx handle. \param _granpos The granule position to convert. \returns The absolute frame index corresponding to \a _granpos. \retval -1 The given granule position was invalid (i.e. negative).
  • Converts a granule position to an absolute time in seconds. The granule position is interpreted in the context of a given #th_enc_ctx or #th_dec_ctx handle (either will suffice). \param _encdec A previously allocated #th_enc_ctx or #th_dec_ctx handle. \param _granpos The granule position to convert. \return The absolute time in seconds corresponding to \a _granpos. This is the “end time” for the frame, or the latest time it should be displayed. It is not the presentation time. \retval -1 The given granule position was invalid (i.e. negative).
  • Clears a #th_info structure. This should be called on a #th_info structure after it is no longer needed. \param _info The #th_info struct to clear.
  • Initializes a th_info structure. This should be called on a freshly allocated #th_info structure before attempting to use it. \param _info The #th_info struct to initialize.
  • Determines whether a Theora packet is a header or not. This function does no verification beyond checking the packet type bit, so it should not be used for bitstream identification; use th_decode_headerin() for that. As per the Theora specification, an empty (0-byte) packet is treated as a data packet (a delta frame with no coded blocks). \param _op An ogg_packet containing encoded Theora data. \retval 1 The packet is a header packet \retval 0 The packet is a video data packet.
  • Determines whether a theora packet is a key frame or not. This function does no verification beyond checking the packet type and key frame bits, so it should not be used for bitstream identification; use th_decode_headerin() for that. As per the Theora specification, an empty (0-byte) packet is treated as a delta frame (with no coded blocks). \param _op An ogg_packet containing encoded Theora data. \retval 1 The packet contains a key frame. \retval 0 The packet contains a delta frame. \retval -1 The packet is not a video data packet.
  • 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(). \param _setup The setup information to free. This can safely be NULL.
  • Retrieves the library version number. This is the highest bitstream version that the encoder library will produce, or that the decoder library can decode. This number is composed of a 16-bit major version, 8-bit minor version and 8 bit sub-version, composed as follows: \code (VERSION_MAJOR<<16)+(VERSION_MINOR<<8)+(VERSION_SUBMINOR) \endcode \return the version number.
  • Retrieves a human-readable string to identify the library vendor and version. \return the version string.

Type Aliases§

Unions§