if (strncmp("SACDMTOC", master_toc->id, 8) != 0)
{
fprintf(stderr, "libsacdread: Try use 2064 SACD sector size!\n");
sacd_sector_size = SACD_PSN_SIZE;
if (!sacd_read_block_raw(handle->sacd, START_OF_MASTER_TOC, MASTER_TOC_LEN, handle->master_data))
return 0;
}
if (strncmp("SACDMTOC", master_toc->id, 8) != 0)
{
fprintf(stderr, "libsacdread: Not a ScarletBook disc!\n");
return 0;
}
_ sacd_input.c __
/**
read data from the device.
/
static ssize_t sacd_dev_input_read(sacd_input_t dev, int pos, int blocks, void buffer)
{
if defined(lv2ppu)
int ret;
uint32_t sectors_read;
ret = sys_storage_read(dev->fd, pos, blocks, buffer, §ors_read);
return (ret != 0) ? 0 : sectors_read;
else
ssize_t ret = 0;
switch (sacd_sector_size) {
case SACD_LSN_SIZE:
{
ret = lseek(dev->fd, (off_t)pos * (off_t)SACD_LSN_SIZE, SEEK_SET);
if (ret < 0) return 0;
ret = read(dev->fd, buffer, (unsigned int)blocks * SACD_LSN_SIZE); //if (ret < 0) return ret; //One of the reads failed, too bad. We won't even bother returning the reads that went OK, and as in the POSIX spec the file position is left unspecified after a failure.
if (ret != blocks * SACD_LSN_SIZE) return 0;
break;
}
case SACD_PSN_SIZE:
{
for (uint32_t i = 0; i < blocks; i++)
{
ret = lseek(dev->fd, (off_t)(pos + i) * (off_t)SACD_PSN_SIZE + 12, SEEK_SET);
if (ret < 0) return 0;
ret = read(dev->fd, (uint8_t*)buffer + i * SACD_LSN_SIZE, SACD_LSN_SIZE);
if (ret != SACD_LSN_SIZE) return 0;
}
break;
}
}
return blocks;
Please add those code to read 2064 bytes sectors. (stolen from foo_input_sacd-0.9.6)
___ scarletbook.h ____ /**
define SACD_LSN_SIZE 2048
define SACD_PSN_SIZE 2064
extern uint32_t sacd_sector_size;
___ scarletbook.c ____
include "scarletbook.h"
uint32_t sacd_sector_size = SACD_LSN_SIZE;
_ scarletbook_read.c __ master_toc = handle->master_toc = (master_toc_t *) handle->master_data;
if (strncmp("SACDMTOC", master_toc->id, 8) != 0) { fprintf(stderr, "libsacdread: Try use 2064 SACD sector size!\n"); sacd_sector_size = SACD_PSN_SIZE; if (!sacd_read_block_raw(handle->sacd, START_OF_MASTER_TOC, MASTER_TOC_LEN, handle->master_data)) return 0; }
_ sacd_input.c __ /**
read data from the device. / static ssize_t sacd_dev_input_read(sacd_input_t dev, int pos, int blocks, void buffer) {
if defined(lv2ppu)
int ret; uint32_t sectors_read;
ret = sys_storage_read(dev->fd, pos, blocks, buffer, §ors_read);
return (ret != 0) ? 0 : sectors_read;
else
endif
}