Preparations for option -isosize via fifo (only a debug message yet)

ZeroThreeEight
Thomas Schmitt 16 years ago
parent 749d12591e
commit 5d65697697
  1. 30
      cdrskin/cdrfifo.c
  2. 5
      cdrskin/cdrfifo.h
  3. 40
      cdrskin/cdrskin.c
  4. 2
      cdrskin/cdrskin_timestamp.h

@ -77,6 +77,8 @@ struct CdrfifO {
double empty_counter;
double full_counter;
/* eventual ISO-9660 image size obtained from first 64k of input */
double iso_fs_size;
/* (sequential) fd chaining */
/* fds: 0=source, 1=dest */
@ -159,6 +161,7 @@ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd,
o->get_counter= 0.0;
o->empty_counter= 0.0;
o->full_counter= 0.0;
o->iso_fs_size= -1.0;
for(i= 0; i<Cdrfifo_ffd_maX; i++) {
o->follow_up_fds[i][0]= o->follow_up_fds[i][1]= -1;
o->follow_up_eop[i]= o->follow_up_sod[i]= -1;
@ -390,6 +393,13 @@ int Cdrfifo_get_min_fill(struct CdrfifO *o, int *total_min_fill,
}
int Cdrfifo_get_iso_fs_size(struct CdrfifO *o, double *size_in_bytes, int flag)
{
*size_in_bytes= o->iso_fs_size;
return(o->iso_fs_size>=2048);
}
/** Get counters which are mentioned by cdrecord at the end of burning.
It still has to be examined wether they mean what i believe they do.
*/
@ -398,7 +408,7 @@ int Cdrfifo_get_cdr_counters(struct CdrfifO *o,
double *empty_counter, double *full_counter,
int flag)
{
*put_counter= o->put_counter;;
*put_counter= o->put_counter;
*get_counter= o->get_counter;
*empty_counter= o->empty_counter;
*full_counter= o->full_counter;
@ -870,6 +880,24 @@ int Cdrfifo_fill(struct CdrfifO *o, int size, int flag)
if(ret==2)
break;
}
#ifndef Cdrfifo_standalonE
{ int Scan_for_iso_size(unsigned char data[2048], double *size_in_bytes,
int flag);
int i;
double size;
/* try to obtain an ISO-9660 file system size */
for(i= 0; i<32*2048 && i+2048<=fill; i+=2048) {
ret= Scan_for_iso_size((unsigned char *) (o->buffer+i), &size, 0);
if(ret<=0)
continue;
o->iso_fs_size= size;
break;
}
}
#endif
o->total_min_fill= fill;
o->interval_min_fill= fill;
return(1);

@ -117,6 +117,11 @@ int Cdrfifo_get_cdr_counters(struct CdrfifO *o,
double *empty_counter, double *full_counter,
int flag);
/** Inquire the eventually detected size of an eventual ISO-9660 file system
@return 0=no ISO resp. size detected, 1=size_in_bytes is valid
*/
int Cdrfifo_get_iso_fs_size(struct CdrfifO *o, double *size_in_bytes,int flag);
/** Check for pending data at the fifo's source file descriptor and wether the
fifo is ready to take them. Simultaneously check the buffer for existing

@ -552,6 +552,25 @@ int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag)
#endif /* ! Cdrskin_extra_leaN */
/* <<< Preliminary sketch : to go into libburn later */
/* Learned from reading growisofs.c ,
watching mkisofs, and viewing its results via od -c */
/* @return 0=no size found , 1=*size_in_bytes is valid */
int Scan_for_iso_size(unsigned char data[2048], double *size_in_bytes,
int flag)
{
double sectors= 0.0;
if(data[0]!=1)
return(0);
if(strncmp((char *) (data+1),"CD001",5)!=0)
return(0);
sectors= data[80] | (data[81]<<8) | (data[82]<<16) | (data[83]<<24);
*size_in_bytes= sectors*2048.0;
return(1);
}
/* --------------------------------------------------------------------- */
/** Address translation table for users/applications which do not look
@ -769,6 +788,9 @@ struct CdrtracK {
int track_type_by_default;
int swap_audio_bytes;
/** Eventually detected data image size */
double data_image_size;
/* wether the data source is a container of defined size with possible tail */
int extracting_container;
@ -837,6 +859,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
o->sector_size= 2048.0;
o->track_type_by_default= 1;
o->swap_audio_bytes= 0;
o->data_image_size= -1.0;
o->extracting_container= 0;
o->fifo_enabled= 0;
o->fifo= NULL;
@ -846,6 +869,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
o->ff_fifo= NULL;
o->ff_idx= -1;
o->libburn_track= NULL;
ret= Cdrskin_get_source(boss,o->source_path,&(o->fixed_size),
&(o->tao_to_sao_tsize),&(o->padding),
&(o->set_by_padsize),&(skin_track_type),
@ -1172,6 +1196,7 @@ int Cdrtrack_attach_fifo(struct CdrtracK *track, int *outlet_fd,
int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag)
{
int ret,buffer_fill,buffer_space;
double data_image_size;
if(track->fifo==NULL || track->fifo_start_at==0)
return(2);
@ -1195,6 +1220,9 @@ int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag)
return(0);
}
}
ret= Cdrfifo_get_iso_fs_size(track->fifo,&data_image_size,0);
if(ret>0)
track->data_image_size= data_image_size;
return(1);
}
@ -5009,6 +5037,18 @@ burn_failed:;
fprintf(stderr,"cdrskin: FATAL : filling of fifo failed\n");
goto ex;
}
/* <<< provisory for testing only */
if(skin->verbosity>=Cdrskin_verbose_debuG)
for(i=0;i<skin->track_counter;i++) {
if(skin->tracklist[i]->data_image_size>=0.0)
fprintf(stderr,
"cdrskin: DEBUG: track %2.2d : ISO size %.fs (= %.fb)\n",
i+1,
skin->tracklist[i]->data_image_size/2048.0,
skin->tracklist[i]->data_image_size);
}
#endif /* ! Cdrskin_extra_leaN */
Cdrskin_adjust_speed(skin,0);

@ -1 +1 @@
#define Cdrskin_timestamP "2007.03.24.093623"
#define Cdrskin_timestamP "2007.03.27.213543"

Loading…
Cancel
Save