hscdio-0.1.0.0: src/c/cdio/compat/disc.c
#include "cdio/compat/disc.h"
#include "cdio/compat/mmc.h"
// FFI-compatible wrappers
const char* discmode_string(discmode_t dm) {
if (dm > CDIO_DISC_MODE_CD_I || dm < CDIO_DISC_MODE_CD_DA)
return discmode2str[CDIO_DISC_MODE_ERROR];
else
return discmode2str[dm];
}
discmode_t discmode_error() {
return CDIO_DISC_MODE_ERROR;
}
// Marshalling aids
void get_cdtext_raw_len(CdIo_t* cdio, uint8_t** data, unsigned int* length) {
*data = cdio_get_cdtext_raw(cdio);
// Source diving to lib/driver/generic.h:read_cdtext_generic()
if (data && *data)
// The CDTEXT length includes the two always-null bytes before the
// data, but *not* the two length bytes themselves.
*length = CDIO_MMC_GET_LEN16(*data) - 2;
else
*length = 0;
}