Enabled byte swapping for audio track sources, added anti option -swab
This commit is contained in:
parent
0d26beb2ed
commit
f95d7aa6aa
@ -184,7 +184,7 @@ Anything except .wav files has to be converted into raw format first
|
|||||||
mppdec --raw-le /path/to/track5.mpc track05.cd
|
mppdec --raw-le /path/to/track5.mpc track05.cd
|
||||||
|
|
||||||
cdrskin dev=1,1,0 blank=fast fs=0 -eject \
|
cdrskin dev=1,1,0 blank=fast fs=0 -eject \
|
||||||
-audio track0[1-5].cd /path/to/track6.wav
|
-audio -swab track0[1-5].cd /path/to/track6.wav
|
||||||
|
|
||||||
|
|
||||||
Usage example with http://scdbackup.sourceforge.net
|
Usage example with http://scdbackup.sourceforge.net
|
||||||
@ -357,7 +357,7 @@ results with audio data files which are :
|
|||||||
44100 Hz sampling rate
|
44100 Hz sampling rate
|
||||||
16 bits per sample
|
16 bits per sample
|
||||||
stereo (2 channels)
|
stereo (2 channels)
|
||||||
little-endian byte order
|
little-endian byte order with option -swab
|
||||||
Files with name extension .wav get examined wether they are in Microsoft WAVE
|
Files with name extension .wav get examined wether they are in Microsoft WAVE
|
||||||
format with above parameters and eventually get extracted by cdrskin itself.
|
format with above parameters and eventually get extracted by cdrskin itself.
|
||||||
All other formats (including SUN's format .au) are to be extracted by commands
|
All other formats (including SUN's format .au) are to be extracted by commands
|
||||||
|
@ -776,6 +776,7 @@ struct CdrtracK {
|
|||||||
int track_type;
|
int track_type;
|
||||||
double sector_size;
|
double sector_size;
|
||||||
int track_type_by_default;
|
int track_type_by_default;
|
||||||
|
int swap_audio_bytes;
|
||||||
|
|
||||||
/** Optional fifo between input fd and libburn. It uses a pipe(2) to transfer
|
/** Optional fifo between input fd and libburn. It uses a pipe(2) to transfer
|
||||||
data to libburn.
|
data to libburn.
|
||||||
@ -812,7 +813,8 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
|
|||||||
int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
|
int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
|
||||||
double *fixed_size, double *padding,
|
double *fixed_size, double *padding,
|
||||||
int *set_by_padsize, int *track_type,
|
int *set_by_padsize, int *track_type,
|
||||||
int *track_type_by_default, int flag);
|
int *track_type_by_default, int *swap_audio_bytes,
|
||||||
|
int flag);
|
||||||
int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled,
|
int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled,
|
||||||
int *fifo_size, int *fifo_start_empty, int flag);
|
int *fifo_size, int *fifo_start_empty, int flag);
|
||||||
|
|
||||||
@ -831,6 +833,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
|
|||||||
o->track_type= BURN_MODE1;
|
o->track_type= BURN_MODE1;
|
||||||
o->sector_size= 2048.0;
|
o->sector_size= 2048.0;
|
||||||
o->track_type_by_default= 1;
|
o->track_type_by_default= 1;
|
||||||
|
o->swap_audio_bytes= 0;
|
||||||
o->fifo_enabled= 0;
|
o->fifo_enabled= 0;
|
||||||
o->fifo= NULL;
|
o->fifo= NULL;
|
||||||
o->fifo_outlet_fd= -1;
|
o->fifo_outlet_fd= -1;
|
||||||
@ -839,7 +842,8 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
|
|||||||
o->libburn_track= NULL;
|
o->libburn_track= NULL;
|
||||||
ret= Cdrskin_get_source(boss,o->source_path,&(o->fixed_size),&(o->padding),
|
ret= Cdrskin_get_source(boss,o->source_path,&(o->fixed_size),&(o->padding),
|
||||||
&(o->set_by_padsize),&(skin_track_type),
|
&(o->set_by_padsize),&(skin_track_type),
|
||||||
&(o->track_type_by_default),0);
|
&(o->track_type_by_default),&(o->swap_audio_bytes),
|
||||||
|
0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto failed;
|
goto failed;
|
||||||
Cdrtrack_set_track_type(o,skin_track_type,0);
|
Cdrtrack_set_track_type(o,skin_track_type,0);
|
||||||
@ -964,8 +968,10 @@ int Cdrtrack_extract_audio(struct CdrtracK *track, int *fd, off_t *xtr_size,
|
|||||||
ret= libdax_audioxtr_detach_fd(xtr,fd,0);
|
ret= libdax_audioxtr_detach_fd(xtr,fd,0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
{ret= -1*!!ret; goto ex;}
|
{ret= -1*!!ret; goto ex;}
|
||||||
fprintf(stderr,"cdrskin: NOTE : %.f audio bytes in '%s'\n",
|
track->swap_audio_bytes= !!msb_first;
|
||||||
(double) *xtr_size, track->source_path);
|
fprintf(stderr,"cdrskin: NOTE : %.f %saudio bytes in '%s'\n",
|
||||||
|
(double) *xtr_size, (msb_first ? "" : "(-swab) "),
|
||||||
|
track->source_path);
|
||||||
ret= 1;
|
ret= 1;
|
||||||
ex:
|
ex:
|
||||||
libdax_audioxtr_destroy(&xtr,0);
|
libdax_audioxtr_destroy(&xtr,0);
|
||||||
@ -1179,7 +1185,8 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno,
|
|||||||
}
|
}
|
||||||
burn_track_define_data(tr,0,(int) lib_padding,sector_pad_up,
|
burn_track_define_data(tr,0,(int) lib_padding,sector_pad_up,
|
||||||
track->track_type);
|
track->track_type);
|
||||||
|
burn_track_set_byte_swap(tr,
|
||||||
|
(track->track_type==BURN_AUDIO && track->swap_audio_bytes));
|
||||||
fixed_size= track->fixed_size;
|
fixed_size= track->fixed_size;
|
||||||
if((flag&2) && track->padding>0) {
|
if((flag&2) && track->padding>0) {
|
||||||
if(flag&1)
|
if(flag&1)
|
||||||
@ -1983,6 +1990,8 @@ see_cdrskin_eng_html:;
|
|||||||
"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)\n");
|
"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)\n");
|
||||||
fprintf(stderr,"\t-pad\t\tpadsize=30k\n");
|
fprintf(stderr,"\t-pad\t\tpadsize=30k\n");
|
||||||
fprintf(stderr,"\t-nopad\t\tDo not pad (default)\n");
|
fprintf(stderr,"\t-nopad\t\tDo not pad (default)\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
"\t-swab\t\tAudio data source is byte-swapped (little-endian/Intel)\n");
|
||||||
fprintf(stderr,"\t-help\t\tprint this text to stderr and exit\n");
|
fprintf(stderr,"\t-help\t\tprint this text to stderr and exit\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Option -audio does automatic extraction of .wav but not of .au .\n");
|
"Option -audio does automatic extraction of .wav but not of .au .\n");
|
||||||
@ -2241,6 +2250,7 @@ struct CdrskiN {
|
|||||||
/** track_type may be set to BURN_MODE1, BURN_AUDIO, etc. */
|
/** track_type may be set to BURN_MODE1, BURN_AUDIO, etc. */
|
||||||
int track_type;
|
int track_type;
|
||||||
int track_type_by_default; /* 0= explicit, 1=not set, 2=by file extension */
|
int track_type_by_default; /* 0= explicit, 1=not set, 2=by file extension */
|
||||||
|
int swap_audio_bytes;
|
||||||
|
|
||||||
/** The list of tracks with their data sources and parameters */
|
/** The list of tracks with their data sources and parameters */
|
||||||
struct CdrtracK *tracklist[Cdrskin_track_maX];
|
struct CdrtracK *tracklist[Cdrskin_track_maX];
|
||||||
@ -2343,6 +2353,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
|
|||||||
o->padding= 0.0;
|
o->padding= 0.0;
|
||||||
o->set_by_padsize= 0;
|
o->set_by_padsize= 0;
|
||||||
o->track_type= BURN_MODE1;
|
o->track_type= BURN_MODE1;
|
||||||
|
o->swap_audio_bytes= 0; /* >>> ??? does this have to be 1 ? */
|
||||||
o->track_type_by_default= 1;
|
o->track_type_by_default= 1;
|
||||||
for(i=0;i<Cdrskin_track_maX;i++)
|
for(i=0;i<Cdrskin_track_maX;i++)
|
||||||
o->tracklist[i]= NULL;
|
o->tracklist[i]= NULL;
|
||||||
@ -2413,7 +2424,8 @@ int Cdrskin_destroy(struct CdrskiN **o, int flag)
|
|||||||
int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
|
int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
|
||||||
double *fixed_size, double *padding,
|
double *fixed_size, double *padding,
|
||||||
int *set_by_padsize, int *track_type,
|
int *set_by_padsize, int *track_type,
|
||||||
int *track_type_by_default, int flag)
|
int *track_type_by_default, int *swap_audio_bytes,
|
||||||
|
int flag)
|
||||||
{
|
{
|
||||||
strcpy(source_path,skin->source_path);
|
strcpy(source_path,skin->source_path);
|
||||||
*fixed_size= skin->fixed_size;
|
*fixed_size= skin->fixed_size;
|
||||||
@ -2421,6 +2433,7 @@ int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
|
|||||||
*set_by_padsize= skin->set_by_padsize;
|
*set_by_padsize= skin->set_by_padsize;
|
||||||
*track_type= skin->track_type;
|
*track_type= skin->track_type;
|
||||||
*track_type_by_default= skin->track_type_by_default;
|
*track_type_by_default= skin->track_type_by_default;
|
||||||
|
*swap_audio_bytes= skin->swap_audio_bytes;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4368,7 +4381,7 @@ int Cdrskin_setup(struct CdrskiN *skin, int argc, char **argv, int flag)
|
|||||||
"-immed", "-force", "-raw", "-raw96p", "-raw16",
|
"-immed", "-force", "-raw", "-raw96p", "-raw16",
|
||||||
"-clone", "-text", "-mode2", "-xa", "-xa1", "-xa2", "-xamix",
|
"-clone", "-text", "-mode2", "-xa", "-xa1", "-xa2", "-xamix",
|
||||||
"-cdi", "-isosize", "-preemp", "-nopreemp", "-copy", "-nocopy",
|
"-cdi", "-isosize", "-preemp", "-nopreemp", "-copy", "-nocopy",
|
||||||
"-scms", "-shorttrack", "-noshorttrack", "-swab", "-packet", "-noclose",
|
"-scms", "-shorttrack", "-noshorttrack", "-packet", "-noclose",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4745,6 +4758,9 @@ set_speed:;
|
|||||||
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
||||||
printf("cdrskin: speed : %f\n",skin->x_speed);
|
printf("cdrskin: speed : %f\n",skin->x_speed);
|
||||||
|
|
||||||
|
} else if(strcmp(argv[i],"-swab")==0) {
|
||||||
|
skin->swap_audio_bytes= 0;
|
||||||
|
|
||||||
} else if(strcmp(argv[i],"-tao")==0) {
|
} else if(strcmp(argv[i],"-tao")==0) {
|
||||||
if(skin->tao_to_sao_tsize<=0.0) {
|
if(skin->tao_to_sao_tsize<=0.0) {
|
||||||
fprintf(stderr,"cdrskin: FATAL : libburn does not support -tao yet.\n");
|
fprintf(stderr,"cdrskin: FATAL : libburn does not support -tao yet.\n");
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2006.10.24.075039"
|
#define Cdrskin_timestamP "2006.10.24.102107"
|
||||||
|
@ -849,6 +849,16 @@ int burn_session_remove_track(struct burn_session *s, struct burn_track *t);
|
|||||||
void burn_track_define_data(struct burn_track *t, int offset, int tail,
|
void burn_track_define_data(struct burn_track *t, int offset, int tail,
|
||||||
int pad, int mode);
|
int pad, int mode);
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A61024 */
|
||||||
|
/** Define wether a track shall swap bytes of its input stream.
|
||||||
|
@param t The track to change
|
||||||
|
@param swap_source_bytes 0=do not swap, 1=swap byte pairs
|
||||||
|
@return 1=success , 0=unacceptable value
|
||||||
|
*/
|
||||||
|
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes);
|
||||||
|
|
||||||
|
|
||||||
/** Set the ISRC details for a track
|
/** Set the ISRC details for a track
|
||||||
@param t The track to change
|
@param t The track to change
|
||||||
@param country the 2 char country code. Each character must be
|
@param country the 2 char country code. Each character must be
|
||||||
|
@ -79,7 +79,7 @@ static int get_outmode(struct burn_write_opts *o)
|
|||||||
|
|
||||||
static void get_bytes(struct burn_track *track, int count, unsigned char *data)
|
static void get_bytes(struct burn_track *track, int count, unsigned char *data)
|
||||||
{
|
{
|
||||||
int valid, shortage, curr;
|
int valid, shortage, curr, i, tr;
|
||||||
|
|
||||||
/* no track pointer means we're just generating 0s */
|
/* no track pointer means we're just generating 0s */
|
||||||
if (!track) {
|
if (!track) {
|
||||||
@ -147,9 +147,17 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
|
|||||||
curr += valid;
|
curr += valid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!shortage)
|
ex:;
|
||||||
return;
|
/* ts A61024 : general finalizing processing */
|
||||||
memset(data + curr, 0, shortage);
|
if(shortage)
|
||||||
|
memset(data + curr, 0, shortage); /* this is old icculus.org */
|
||||||
|
if (track->swap_source_bytes == 1) {
|
||||||
|
for (i = 1; i < count; i += 2) {
|
||||||
|
tr = data[i];
|
||||||
|
data[i] = data[i-1];
|
||||||
|
data[i-1] = tr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ts A61009 : seems to hand out sector start pointer in opts->drive->buffer
|
/* ts A61009 : seems to hand out sector start pointer in opts->drive->buffer
|
||||||
|
@ -118,6 +118,9 @@ struct burn_track *burn_track_create(void)
|
|||||||
t->postgap = 0;
|
t->postgap = 0;
|
||||||
t->pregap1 = 0;
|
t->pregap1 = 0;
|
||||||
t->pregap2 = 0;
|
t->pregap2 = 0;
|
||||||
|
|
||||||
|
/* ts A61024 */
|
||||||
|
t->swap_source_bytes = 0;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,6 +230,17 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail,
|
|||||||
t->tail = tail;
|
t->tail = tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A61024 */
|
||||||
|
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes)
|
||||||
|
{
|
||||||
|
if(swap_source_bytes!=0 && swap_source_bytes!=1)
|
||||||
|
return 0;
|
||||||
|
t->swap_source_bytes = swap_source_bytes;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
|
void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
|
||||||
unsigned char year, unsigned int serial)
|
unsigned char year, unsigned int serial)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,10 @@ struct burn_track
|
|||||||
/** The track contains a postgap */
|
/** The track contains a postgap */
|
||||||
int postgap;
|
int postgap;
|
||||||
struct isrc isrc;
|
struct isrc isrc;
|
||||||
|
|
||||||
|
/* ts A61024 */
|
||||||
|
/** Byte swapping on source data stream : 0=none , 1=pairwise */
|
||||||
|
int swap_source_bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct burn_session
|
struct burn_session
|
||||||
|
Loading…
Reference in New Issue
Block a user