Enforce minimum track length with SAO

This commit is contained in:
2007-01-25 18:52:50 +00:00
parent 99f8e0eec5
commit c079e09860
7 changed files with 74 additions and 3 deletions

View File

@ -71,6 +71,8 @@ static off_t file_size(struct burn_source *source)
struct stat buf;
struct burn_source_file *fs = source->data;
if (fs->fixed_size > 0)
return fs->fixed_size;
if (fstat(fs->datafd, &buf) == -1)
return (off_t) 0;
/* for now we keep it compatible to the old (int) return value */
@ -79,6 +81,17 @@ static off_t file_size(struct burn_source *source)
return (off_t) buf.st_size;
}
/* ts A70125 */
static int file_set_size(struct burn_source *source, off_t size)
{
struct burn_source_file *fs = source->data;
fs->fixed_size = size;
return 1;
}
struct burn_source *burn_file_source_new(const char *path, const char *subpath)
{
struct burn_source_file *fs;
@ -103,12 +116,16 @@ struct burn_source *burn_file_source_new(const char *path, const char *subpath)
if (subpath)
fs->subfd = fd2;
/* ts A70125 */
fs->fixed_size = 0;
src = burn_source_new();
src->read = file_read;
if (subpath)
src->read_sub = file_read_sub;
src->get_size = file_size;
src->set_size = file_set_size;
src->free_data = file_free;
src->data = fs;
return src;
@ -132,6 +149,17 @@ static off_t fd_get_size(struct burn_source *source)
return buf.st_size;
}
/* ts A70125 */
static int fd_set_size(struct burn_source *source, off_t size)
{
struct burn_source_fd *fs = source->data;
fs->fixed_size = size;
return 1;
}
static int fd_read(struct burn_source *source,
unsigned char *buffer,
int size)
@ -180,6 +208,7 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size)
if(subfd != -1)
src->read = fd_read_sub;
src->get_size = fd_get_size;
src->set_size = fd_set_size;
src->free_data = fd_free_data;
src->data = fs;
return src;