You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
libisoburn/ng_src/data_source.c

74 lines
1.2 KiB

/*
data source for libisoburn.
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
*/
#include <assert.h>
#include <stdlib.h>
#include <libburn/libburn.h>
/* >>> NG */
#include <libisofs/nglibisofs.h>
#include "isoburn.h"
static int
ds_read_block(IsoDataSource *src, uint32_t lba, uint8_t *buffer)
{
int ret;
struct burn_drive *d;
off_t count;
assert(src && buffer);
d = (struct burn_drive*)src->data;
ret = burn_read_data(d, (off_t) lba * (off_t) 2048, (char *) buffer,
2048, &count, 0);
if (ret <= 0 )
return -1;
return 1;
}
static int
ds_open(IsoDataSource *src)
{
/* nothing to do, device is always grabbed */
return 1;
}
static int
ds_close(IsoDataSource *src)
{
/* nothing to do, device is always grabbed */
return 1;
}
static void
ds_free_data(IsoDataSource *src)
{
/* nothing to do */;
}
IsoDataSource *
isoburn_data_source_new(struct burn_drive *d)
{
IsoDataSource *ret;
if (d==NULL)
return NULL;
ret = malloc(sizeof(IsoDataSource));
if (!ret)
return NULL;
ret->refcount = 1;
ret->read_block = ds_read_block;
ret->open = ds_open;
ret->close = ds_close;
ret->free_data = ds_free_data;
ret->data = d;
return ret;
}