Implemented data extraction from cue sheet FILE type WAVE

This commit is contained in:
Thomas Schmitt 2012-01-06 12:59:20 +00:00
parent 4fd4e72fa1
commit 031fd5593f
5 changed files with 91 additions and 22 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH CDRSKIN 1 "Jan 04, 2012"
.TH CDRSKIN 1 "Jan 06, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -509,7 +509,7 @@ present.
.br
cdrskin currently supports TRACK datatypes AUDIO and MODE1/2048 which may
not be mixed. It ignores commands POSTGAP and PREGAP.
Data source may be of FILE type BINARY or MOTOROLA.
Data source may be of FILE type BINARY, MOTOROLA, or WAVE.
.br
Non-CDRWIN commands ARRANGER, COMPOSER, MESSAGE are supported.
.br

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.01.05.140927"
#define Cdrskin_timestamP "2012.01.06.125849"

View File

@ -6,8 +6,8 @@ by reading mmc3r10g.pdf from http://www.t10.org/ftp/t10/drafts/mmc3/
by docs and results of cdtext.zip from http://www.sonydadc.com/file/
by reading http://digitalx.org/cue-sheet/syntax
by reading source of libcdio from http://www.gnu.org/s/libcdio
which quotes source of cdrecord from ftp://ftp.berlios.de/pub/cdrecord/alpha
by reading man cdrecord from ftp://ftp.berlios.de/pub/cdrecord/alpha
which quotes source of cdrecord from ftp://ftp.berlios.de/pub/cdrecord/alpha
by reading cdrecord.1 from ftp://ftp.berlios.de/pub/cdrecord/alpha
Language codes were learned from http://tech.ebu.ch/docs/tech/tech3264.pdf
Genre codes were learned from libcdio and confirmed by
@ -673,7 +673,7 @@ TITLE "Joyful Nights"
Several restrictions apply in the libburn call burn_session_by_cue_file():
Commands POSTGAP, PREGAP are ignored.
Only FILE types BINARY, MOTOROLA are allowed.
Only FILE types BINARY, MOTOROLA, WAVE are allowed.
Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not be mixed in
the same session.

View File

@ -1866,16 +1866,14 @@ int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s);
http://digitalx.org/cue-sheet/syntax/
>>> fully supported commands: CATALOG CDTEXTFILE FLAGS INDEX ISRC PERFORMER REM
>>> SONGWRITER TITLE
>>> supported commands introduced by cdrecord: ARRANGER COMPOSER MESSAGE
>>> partly supported commands: FILE TRACK
>>> supported FILE types: BINARY MOTOROLA
>>> supported FILE types: BINARY MOTOROLA WAVE
>>> supported TRACK datatypes: AUDIO MODE1/2048
>>> ignored commands: POSTGAP PREGAP
>>> not allowed: mixing of ADUIO and MODE1/2048
>>> not allowed: unsupported FILE types
>>> not allowed: unsupported TRACK datatypes
>>>
>>> man cdrecord documents further commands:
>>> ARRANGER COMPOSER MESSAGE
>>>
@param session Session where to attach tracks. It must not yet have
tracks or else this call will fail.
@ -3785,7 +3783,8 @@ int libdax_audioxtr_new(struct libdax_audioxtr **xtr, char *path, int flag);
@param num_channels e.g. 1=mono, 2=stereo, etc
@param sample_rate e.g. 11025, 44100
@param bits_per_sample e.g. 8= 8 bits per sample, 16= 16 bits ...
@param msb_first Byte order of samples: 0=Intel 1=Motorola
@param msb_first Byte order of samples: 0= Intel = Little Endian
1= Motorola = Big Endian
@param flag Bitfield for control purposes (unused yet, submit 0)
@return >0 success, <=0 failure
@since 0.2.4

View File

@ -1277,6 +1277,70 @@ ex:
}
/* @param flag bit0-7: desired type : 0=any , 1=.wav
*/
static int cue_open_audioxtr(char *path, struct burn_cue_file_cursor *crs,
int *fd, int flag)
{
struct libdax_audioxtr *xtr= NULL;
char *fmt, *fmt_info;
int ret, num_channels, sample_rate, bits_per_sample, msb_first;
char *msg = NULL;
BURN_ALLOC_MEM(msg, char, 4096);
/* >>> obtain fd by libdax_audioxtr */;
ret= libdax_audioxtr_new(&xtr, path, 0);
if (ret <= 0)
return ret;
libdax_audioxtr_get_id(xtr, &fmt, &fmt_info, &num_channels,
&sample_rate, &bits_per_sample, &msb_first, 0);
if ((flag & 255) == 1) {
if (strcmp(fmt, ".wav") != 0) {
sprintf(msg,
"In cue sheet: Not recognized as WAVE : FILE '%.4000s'",
path);
libdax_msgs_submit(libdax_messenger, -1, 0x00020193,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
burn_printify(msg), 0, 0);
ret = 0; goto ex;
}
}
ret = libdax_audioxtr_get_size(xtr, &(crs->source_size), 0);
if (ret <= 0) {
sprintf(msg,
"In cue sheet: Cannot get payload size of FILE '%.4000s'",
path);
libdax_msgs_submit(libdax_messenger, -1, 0x00020193,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
burn_printify(msg), 0, 0);
ret = 0; goto ex;
}
ret = libdax_audioxtr_detach_fd(xtr, fd, 0);
if (ret <= 0) {
sprintf(msg,
"In cue sheet: Cannot represent payload as plain fd: FILE '%.4000s'",
path);
libdax_msgs_submit(libdax_messenger, -1, 0x00020193,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
burn_printify(msg), 0, 0);
ret = 0; goto ex;
}
crs->swap_audio_bytes = (msb_first == 1);
ret = 1;
ex:
if (xtr != NULL)
libdax_audioxtr_destroy(&xtr, 0);
BURN_FREE_MEM(msg);
return ret;
}
/* @param flag bit0-7: desired type : 0=any , 1=.wav
bit8= open by libdax_audioxtr functions
*/
static int cue_create_file_source(char *path, struct burn_cue_file_cursor *crs,
int flag)
{
@ -1285,14 +1349,22 @@ static int cue_create_file_source(char *path, struct burn_cue_file_cursor *crs,
BURN_ALLOC_MEM(msg, char, 4096);
if (flag & 256) {
ret = cue_open_audioxtr(path, crs, &fd, flag & 255);
if (ret <= 0)
goto ex;
} else {
fd = open(path, O_RDONLY);
if (fd == -1) {
sprintf(msg, "In cue sheet: Cannot open FILE '%.4000s'", path);
sprintf(msg,
"In cue sheet: Cannot open FILE '%.4000s'",
path);
libdax_msgs_submit(libdax_messenger, -1, 0x00020193,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
burn_printify(msg), errno, 0);
ret = 0; goto ex;
}
}
crs->file_source = burn_fd_source_new(fd, -1, crs->source_size);
if (crs->file_source == NULL) {
ret = -1; goto ex;
@ -1309,7 +1381,7 @@ static int cue_interpret_line(struct burn_session *session, char *line,
struct burn_cue_file_cursor *crs, int flag)
{
int ret, mode, index_no, minute, second, frame, file_ba, chunks;
int block_size, step;
int block_size, step, audio_xtr = 0;
off_t size;
char *cmd, *apt, *msg = NULL, msf[3], *msf_pt, *cpt, *filetype;
struct burn_source *src, *inp_src;
@ -1399,10 +1471,8 @@ out_of_mem:;
crs->swap_audio_bytes = 0;
} else if (strcmp(filetype, "MOTOROLA") == 0) {
crs->swap_audio_bytes = 1;
} else if (strcmp(filetype, "WAVE") == 0 && 0 ) {
/* >>> Use libdax_audioxtr_* functions to extract */;
} else if (strcmp(filetype, "WAVE") == 0) {
audio_xtr = 0x101;
} else {
sprintf(msg,
"In cue sheet file: Unsupported FILE type '%.4000s'",
@ -1436,7 +1506,7 @@ not_usable_file:;
crs->source_file = strdup(apt);
if (crs->source_file == NULL)
goto out_of_mem;
ret = cue_create_file_source(apt, crs, 0);
ret = cue_create_file_source(apt, crs, audio_xtr);
if (ret <= 0)
goto ex;