#ifndef dvd_io_h
#define dvd_io_h

#include "dvd_desc.h"
#include "ka_error.h"

typedef struct dvd_io_s dvd_io_t;

dvd_io_t* dvd_io_new(ka_error_t* pErrorBlock, int drive);
void dvd_io_delete(dvd_io_t** pio);

int dvd_io_parseIso(dvd_io_t* io, dvd_desc_t* dvd);
int dvd_io_loadVmgIfo(dvd_io_t* io, dvd_ifo_desc_t* ifo);
int dvd_io_loadVtsIfo(dvd_io_t* io, dvd_ifo_desc_t* ifo, int i);
const _kernel_oserror* dvd_io_getTitleKey(dvd_io_t* io, uint32_t lbaStart, uint32_t lbaEnd, dvd_key_t titleKey);
const _kernel_oserror* dvd_io_readBlocks(dvd_io_t* io, uint32_t lba, uint8_t* sector, int nr);
void dvd_io_unscramble(dvd_io_t* io, const dvd_key_t titleKey, uint8_t* sector);
int dvd_io_load_desc(dvd_io_t* io, dvd_desc_t* dvd);

#endif
