Gave up adapter to old libisofs. Renaming libisoburn and xorriso dirs.
This commit is contained in:
83
libisoburn/data_source.c
Normal file
83
libisoburn/data_source.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
data source for libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifndef Xorriso_standalonE
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
#include <libisofs/libisofs.h>
|
||||
|
||||
#else /* ! Xorriso_standalonE */
|
||||
|
||||
#include "../libisofs/libisofs.h"
|
||||
#include "../libburn/libburn.h"
|
||||
|
||||
#endif /* Xorriso_standalonE */
|
||||
|
||||
|
||||
#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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user