Made single track TAO work without fixed size (compile -experimental)
This commit is contained in:
parent
7546e8735e
commit
a3709dc8ff
@ -995,7 +995,7 @@ ex:
|
||||
*/
|
||||
int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
||||
{
|
||||
int is_wav= 0;
|
||||
int is_wav= 0, size_from_file= 0;
|
||||
off_t xtr_size= 0;
|
||||
|
||||
if(track->source_path[0]=='-' && track->source_path[1]==0)
|
||||
@ -1027,10 +1027,21 @@ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
||||
if(fstat(*fd,&stbuf)!=-1)
|
||||
track->fixed_size= stbuf.st_size;
|
||||
}
|
||||
size_from_file= 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Cdrskin_allow_libburn_taO
|
||||
|
||||
if(track->fixed_size < Cdrtrack_minimum_sizE * track->sector_size
|
||||
&& (track->fixed_size>0 || size_from_file)) {
|
||||
|
||||
#else
|
||||
|
||||
if(track->fixed_size < Cdrtrack_minimum_sizE * track->sector_size) {
|
||||
|
||||
#endif
|
||||
|
||||
if(track->track_type == BURN_AUDIO) {
|
||||
/* >>> cdrecord: We differ in automatic padding with audio:
|
||||
Audio tracks must be at least 705600 bytes and a multiple of 2352.
|
||||
@ -1044,7 +1055,7 @@ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
||||
"cdrskin: NOTE : Enforcing minimum track size of %.f bytes\n",
|
||||
Cdrtrack_minimum_sizE*track->sector_size);
|
||||
track->fixed_size= Cdrtrack_minimum_sizE*track->sector_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
track->source_fd= *fd;
|
||||
return(*fd>=0);
|
||||
@ -4789,14 +4800,18 @@ set_speed:;
|
||||
printf("cdrskin: NOTE : substituting mode -tao by mode -sao\n");
|
||||
goto set_sao;
|
||||
|
||||
#endif /* Cdrskin_allow_libburn_taO */
|
||||
#endif /* ! Cdrskin_allow_libburn_taO */
|
||||
|
||||
} else if(strncmp(argv[i],"tao_to_sao_tsize=",17)==0) {
|
||||
skin->tao_to_sao_tsize= Scanf_io_size(argv[i]+17,0);
|
||||
if(skin->tao_to_sao_tsize>Cdrskin_tracksize_maX)
|
||||
goto track_too_large;
|
||||
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
||||
#ifdef Cdrskin_allow_libburn_taO
|
||||
printf("cdrskin: size default for non-tao write modes: %.f\n",
|
||||
#else
|
||||
printf("cdrskin: replace -tao by -sao with fixed size : %.f\n",
|
||||
#endif
|
||||
skin->tao_to_sao_tsize);
|
||||
|
||||
} else if(strcmp(argv[i],"-toc")==0) {
|
||||
@ -4840,16 +4855,19 @@ track_too_large:;
|
||||
return(0);
|
||||
}
|
||||
skin->stdin_source_used= 1;
|
||||
if(skin->write_type!=BURN_WRITE_TAO &&
|
||||
skin->fixed_size<=0.0 && skin->tao_to_sao_tsize>0.0) {
|
||||
skin->fixed_size= skin->tao_to_sao_tsize;
|
||||
printf(
|
||||
if(skin->fixed_size<=0.0) {
|
||||
if(skin->write_type==BURN_WRITE_TAO) {
|
||||
/* with TAO it is ok to have an undefined track length */;
|
||||
} else if(skin->tao_to_sao_tsize>0.0) {
|
||||
skin->fixed_size= skin->tao_to_sao_tsize;
|
||||
printf(
|
||||
"cdrskin: NOTE : augmenting non-tao write mode by tao_to_sao_tsize\n");
|
||||
printf("cdrskin: NOTE : fixed size : %.f\n",skin->fixed_size);
|
||||
} else if(skin->fixed_size<=0) {
|
||||
fprintf(stderr,
|
||||
printf("cdrskin: NOTE : fixed size : %.f\n",skin->fixed_size);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"cdrskin: FATAL : \"-\" (stdin) needs a fixed tsize= or tao_to_sao_tsize=\n");
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
} else if(skin->preskin->allow_fd_source==0 &&
|
||||
argv[i][0]=='#' && (argv[i][1]>='0' && argv[i][1]<='9')) {
|
||||
|
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2006.10.31.115606"
|
||||
#define Cdrskin_timestamP "2006.10.31.184736"
|
||||
|
@ -125,7 +125,7 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
|
||||
valid = track->source->read(track->source, data + curr, count - curr);
|
||||
} else valid = 0;
|
||||
|
||||
if (valid == -1) {
|
||||
if (valid <= 0) { /* ts A61031 : extended from (valid == -1) */
|
||||
track->eos = 1;
|
||||
valid = 0;
|
||||
}
|
||||
@ -159,6 +159,12 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
|
||||
if (!shortage)
|
||||
goto ex;
|
||||
|
||||
/* ts A61031 */
|
||||
if (shortage >= count)
|
||||
track->track_data_done = 1;
|
||||
if (track->open_ended)
|
||||
goto ex;
|
||||
|
||||
/* If we're still short, and there's a "next" pointer, we pull from that.
|
||||
if that depletes, we'll just fill with 0s.
|
||||
*/
|
||||
@ -233,6 +239,32 @@ static unsigned char *get_sector(struct burn_write_opts *opts, int inmode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ts A61031 */
|
||||
/* Revoke the counting of the most recent sector handed out by get_sector() */
|
||||
static void unget_sector(struct burn_write_opts *opts, int inmode)
|
||||
{
|
||||
struct burn_drive *d = opts->drive;
|
||||
struct buffer *out = d->buffer;
|
||||
int outmode;
|
||||
int seclen;
|
||||
|
||||
outmode = get_outmode(opts);
|
||||
if (outmode == 0)
|
||||
outmode = inmode;
|
||||
|
||||
/* ts A61009 : react on eventual failure of burn_sector_length()
|
||||
(should not happen if API tested properly).
|
||||
Ensures out->bytes >= out->sectors */
|
||||
seclen = burn_sector_length(outmode);
|
||||
if (seclen <= 0)
|
||||
return NULL;
|
||||
seclen += burn_subcode_length(outmode);
|
||||
|
||||
out->bytes -= seclen;
|
||||
out->sectors--;
|
||||
}
|
||||
|
||||
|
||||
/* either inmode == outmode, or outmode == raw. anything else is bad news */
|
||||
/* ts A61010 : changed type to int in order to propagate said bad news */
|
||||
/** @return 1 is ok, <= 0 is failure */
|
||||
@ -598,6 +630,12 @@ int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub)
|
||||
if (convert_data(o, t, t->mode, data) <= 0)
|
||||
return 0;
|
||||
|
||||
/* ts A61031 */
|
||||
if (t->open_ended && t->track_data_done) {
|
||||
unget_sector(o, t->mode);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!t->source->read_sub)
|
||||
subcode_user(o, subs, t->entry->point,
|
||||
t->entry->control, 1, &t->isrc, psub);
|
||||
|
@ -22,6 +22,10 @@ enum burn_source_status burn_track_set_source(struct burn_track *t,
|
||||
return BURN_SOURCE_FAILED;
|
||||
s->refcount++;
|
||||
t->source = s;
|
||||
|
||||
/* ts A61031 */
|
||||
t->open_ended= (s->get_size(s) <= 0);
|
||||
|
||||
return BURN_SOURCE_OK;
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,12 @@ struct burn_track *burn_track_create(void)
|
||||
t->pad = 1;
|
||||
t->entry = NULL;
|
||||
t->source = NULL;
|
||||
|
||||
/* ts A61031 */
|
||||
t->eos = 0;
|
||||
t->open_ended = 0;
|
||||
t->track_data_done = 0;
|
||||
|
||||
t->postgap = 0;
|
||||
t->pregap1 = 0;
|
||||
t->pregap2 = 0;
|
||||
@ -318,6 +324,18 @@ int burn_track_get_sectors(struct burn_track *t)
|
||||
return sectors;
|
||||
}
|
||||
|
||||
/* ts A61031 */
|
||||
int burn_track_is_open_ended(struct burn_track *t)
|
||||
{
|
||||
return !!t->open_ended;
|
||||
}
|
||||
|
||||
/* ts A61031 */
|
||||
int burn_track_is_data_done(struct burn_track *t)
|
||||
{
|
||||
return !!t->track_data_done;
|
||||
}
|
||||
|
||||
int burn_track_get_shortage(struct burn_track *t)
|
||||
{
|
||||
int size;
|
||||
|
@ -31,6 +31,13 @@ struct burn_track
|
||||
struct burn_source *source;
|
||||
/** End of Source flag */
|
||||
int eos;
|
||||
|
||||
/* ts A61031 */
|
||||
/** Source is of undefined length */
|
||||
int open_ended;
|
||||
/** End of open ended track flag : offset+payload+tail are delivered */
|
||||
int track_data_done;
|
||||
|
||||
/** The audio/data mode for the entry. Derived from control and
|
||||
possibly from reading the track's first sector. */
|
||||
int mode;
|
||||
@ -71,4 +78,10 @@ struct burn_disc
|
||||
|
||||
int burn_track_get_shortage(struct burn_track *t);
|
||||
|
||||
|
||||
/* ts A61031 : might go to libburn.h */
|
||||
int burn_track_is_open_ended(struct burn_track *t);
|
||||
int burn_track_is_data_done(struct burn_track *t);
|
||||
|
||||
|
||||
#endif /* BURN__STRUCTURE_H */
|
||||
|
@ -469,7 +469,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
{
|
||||
struct burn_track *t = s->track[tnum];
|
||||
struct burn_drive *d = o->drive;
|
||||
int i, tmp = 0;
|
||||
int i, tmp = 0, open_ended = 0;
|
||||
int sectors;
|
||||
|
||||
d->rlba = -150;
|
||||
@ -505,6 +505,11 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
|
||||
/* user data */
|
||||
sectors = burn_track_get_sectors(t);
|
||||
open_ended = burn_track_is_open_ended(t);
|
||||
|
||||
/* <<< ts A61031 */
|
||||
fprintf(stderr, "libburn_experimental: sectors= %d , open_ended= %d\n",
|
||||
sectors,open_ended);
|
||||
|
||||
/* Update progress */
|
||||
d->progress.start_sector = d->nwa;
|
||||
@ -521,7 +526,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
if (tnum == s->tracks)
|
||||
tmp = sectors > 150 ? 150 : sectors;
|
||||
|
||||
for (i = 0; i < sectors - tmp; i++) {
|
||||
for (i = 0; open_ended || i < sectors - tmp; i++) {
|
||||
|
||||
/* ts A61023 : http://libburn.pykix.org/ticket/14
|
||||
From time to time inquire drive buffer */
|
||||
@ -531,6 +536,13 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
if (!sector_data(o, t, 0))
|
||||
return 0;
|
||||
|
||||
/* ts A61031 */
|
||||
if (open_ended) {
|
||||
d->progress.sectors = sectors = i;
|
||||
if (burn_track_is_data_done(t))
|
||||
break;
|
||||
}
|
||||
|
||||
/* update current progress */
|
||||
d->progress.sector++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user