pub unsafe extern "C" fn mmc_read_toc_cdtext(
p_cdio: *const CdIo_t,
i_length: *mut c_uint,
p_buf: *mut c_uchar,
i_timeout_ms: c_uint,
) -> driver_return_code_tExpand description
Issue a READ TOC/PMA/ATIP command to read the CD-TEXT from R-W sub-channel.
On a successful return (when \p DRIVER_OP_SUCCESS is returned), \p pbuf contains the raw SCSI/MMC reply as retrieved by mmc_read_toc_cdtext().
The first two bytes of the header, a Big-Endian number, specifies the number of following bytes. The count also includes the next two header bytes which should be 0. See Section 6.25.3.7 Response Format 0101b: CD-TEXT, and Table 489, page 475 of the MMC-6 draft 2g specification.
Here is code that can be used to get the number of text packs: @code #include <cdio/mmc.h> CDIO_MMC_GET_LEN16(p_buf) - 2 @endcode and start of the text packs is at: @code p_buf + 4 @endcode
The number of bytes returned is limited by the value in parameter \p *i_length. which should tell the byte capacity of \p p_buf. The maximum size according to specification is 4 + 8 * 256 * 18 = 36,864 bytes.
Instead of retrieving everything in one go by allocating the maximum possible value in the passed-in \p *p_buf, another approach is to first get the header bytes in a small \p p_buf, then re-allocate the buffer using the length given by \p CDIO_MMC_GET_LEN16(p_buf) + 2 (bytes), and then to call mmc_read_toc_cdtext() again with \p *i_length set to this size.
@param p_cdio the CD object to be acted upon. @param i_length pointer to number of bytes to request. Will be overwritten by the number of bytes available. @param p_buf pointer to the location for the returned data @param i_timeout_ms value in milliseconds to use on timeout. Setting to 0 uses the default time-out value stored in \p mmc_timeout_ms.
@return \p DRIVER_OP_SUCCESS on success