Enforce minimum track length with SAO
This commit is contained in:
parent
99f8e0eec5
commit
c079e09860
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2007.01.25.145846"
|
||||
#define Cdrskin_timestamP "2007.01.25.185214"
|
||||
|
@ -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;
|
||||
|
@ -3,10 +3,16 @@
|
||||
#ifndef BURN__FILE_H
|
||||
#define BURN__FILE_H
|
||||
|
||||
/* ts A70125 :
|
||||
Looks like burn_source_file and burn_source_fd become identical because
|
||||
of the need to set a fixed_size of at least 600 kB.
|
||||
I will try to unify both classes.
|
||||
*/
|
||||
struct burn_source_file
|
||||
{
|
||||
int datafd;
|
||||
int subfd;
|
||||
off_t fixed_size;
|
||||
};
|
||||
|
||||
|
||||
|
@ -290,6 +290,9 @@ struct burn_source {
|
||||
/** Get the size of the source's data */
|
||||
off_t (*get_size)(struct burn_source *);
|
||||
|
||||
/** Set the size of the source's data */
|
||||
int (*set_size)(struct burn_source *source, off_t size);
|
||||
|
||||
/** Clean up the source specific data */
|
||||
void (*free_data)(struct burn_source *);
|
||||
|
||||
|
@ -317,6 +317,7 @@ void burn_track_clear_isrc(struct burn_track *t)
|
||||
|
||||
int burn_track_get_sectors(struct burn_track *t)
|
||||
{
|
||||
/* ts A70125 : was int */
|
||||
off_t size;
|
||||
int sectors, seclen;
|
||||
|
||||
@ -329,6 +330,22 @@ int burn_track_get_sectors(struct burn_track *t)
|
||||
return sectors;
|
||||
}
|
||||
|
||||
|
||||
/* ts A70125 */
|
||||
int burn_track_set_sectors(struct burn_track *t, int sectors)
|
||||
{
|
||||
off_t size, seclen;
|
||||
int ret;
|
||||
|
||||
seclen = burn_sector_length(t->mode);
|
||||
size = seclen * (off_t) sectors - (off_t) t->offset - (off_t) t->tail;
|
||||
if (size < 0)
|
||||
return 0;
|
||||
ret = t->source->set_size(t->source, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* ts A61031 */
|
||||
int burn_track_is_open_ended(struct burn_track *t)
|
||||
{
|
||||
|
@ -88,5 +88,8 @@ int burn_track_get_shortage(struct burn_track *t);
|
||||
int burn_track_is_open_ended(struct burn_track *t);
|
||||
int burn_track_is_data_done(struct burn_track *t);
|
||||
|
||||
/* ts A70125 */
|
||||
int burn_track_set_sectors(struct burn_track *t, int sectors);
|
||||
|
||||
|
||||
#endif /* BURN__STRUCTURE_H */
|
||||
|
@ -298,7 +298,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
|
||||
struct burn_session *session,
|
||||
int nwa)
|
||||
{
|
||||
int i, m, s, f, form, pform, runtime = -150, ret;
|
||||
int i, m, s, f, form, pform, runtime = -150, ret, track_length;
|
||||
unsigned char ctladr;
|
||||
struct burn_drive *d;
|
||||
struct burn_toc_entry *e;
|
||||
@ -451,7 +451,20 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
|
||||
if (ret <= 0)
|
||||
goto failed;
|
||||
|
||||
runtime += burn_track_get_sectors(tar[i]);
|
||||
/* ts A70125 :
|
||||
Still not understanding the sense behind linking tracks,
|
||||
i decided to at least enforce the MMC specs' minimum
|
||||
track length.
|
||||
*/
|
||||
track_length = burn_track_get_sectors(tar[i]);
|
||||
if (track_length < 300) {
|
||||
track_length = 300;
|
||||
if (!tar[i]->pad)
|
||||
tar[i]->pad = 1;
|
||||
burn_track_set_sectors(tar[i], track_length);
|
||||
}
|
||||
runtime += track_length;
|
||||
|
||||
/* if we're padding, we'll clear any current shortage.
|
||||
if we're not, we'll slip toc entries by a sector every time our
|
||||
shortage is more than a sector
|
||||
|
Loading…
Reference in New Issue
Block a user