Skip to main content

cdtext_data_init

Function cdtext_data_init 

Source
pub unsafe extern "C" fn cdtext_data_init(
    p_cdtext: *mut cdtext_t,
    wdata: *mut u8,
    i_data: usize,
) -> c_int
Expand description

Fill a cdtext_t object with text pack bytes as they were handed out by the CD drive, but without the 4-byte header which the drive prepended.

The text pack data can be obtained by the calls

  • cdio_get_cdtext_raw()
  • mmc_read_cdtext()
  • mmc_read_toc_cdtext()

Each sets in the buffer passed into values that begin with a 4-byte header. This should be skipped. Here is some sample code:

@code #include <cdio/mmc_ll_cmds.h> if (DRIVER_OP_SUCCESS == mmc_read_toc_cdtext (p_cdio, &i_length, p_buf, 0) && 4 < i_length) cdtext_data_init(p_cdtext, p_buf + 4, (size_t) i_length - 4); @endcode

Instead of calling cdtext_data_init(), you can call cdio_get_cdtext() which returns a pointer to the \p cdtext_t object that is attached to the inquired \p CdIo_t object. This \p cdtext_t object gets created and filled if none is yet attached to the inquired \p CdIo_t object.

@param p_cdtext the CD-TEXT object @param wdata the data @param i_data size of wdata

@returns 0 on success, non-zero on failure