New API call burn_session_set_start_tno()

This commit is contained in:
Thomas Schmitt 2012-01-07 19:09:15 +00:00
parent 775eb175b6
commit 18efcd6299
9 changed files with 82 additions and 33 deletions

View File

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

View File

@ -340,7 +340,7 @@ int burn_drive_send_default_page_05(struct burn_drive *d, int flag)
else
burn_write_opts_set_write_type(opts,
BURN_WRITE_SAO, BURN_BLOCK_SAO);
d->send_write_parameters(d, NULL, 0, opts);
d->send_write_parameters(d, NULL, -1, opts);
burn_write_opts_free(opts);
d->sent_default_page_05 = 1;
return 1;
@ -2513,7 +2513,7 @@ int burn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
if (d->drive_role != 1)
return 0;
if (o != NULL)
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
ret = d->get_nwa(d, trackno, lba, nwa);
return ret;
}
@ -2566,7 +2566,7 @@ off_t burn_disc_available_space(struct burn_drive *d,
(off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048);
} else {
if (o != NULL)
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
d->get_nwa(d, -1, &lba, &nwa);
}
if (o != NULL) {

View File

@ -1932,6 +1932,22 @@ int burn_session_add_track(struct burn_session *s, struct burn_track *t,
int burn_session_remove_track(struct burn_session *s, struct burn_track *t);
/* ts B20107 */
/** Set the number which shall be written as CD track number with the first
track of the session. The following tracks will then get written with
consequtive CD track numbers. The resulting number of the last track
must not exceed 99. The lowest possible start number is 1, which is also
the default. This setting applies only to CD SAO writing.
@param session The session to be manipulated
@param tno A number between 1 and 99
@param flag Bitfield for control purposes. Unused yet. Submit 0.
@return > 0 indicates success, <= 0 indicates failure
@since 1.2.0
*/
int burn_session_set_start_tno(struct burn_session *session, int tno,
int flag);
/* ts B11206 */
/** Set the Character Codes, the Copyright bytes, and the Language Codes
for CD-TEXT blocks 0 to 7. They will be used in the block summaries

View File

@ -129,6 +129,7 @@ burn_session_input_sheet_v07t;
burn_session_remove_track;
burn_session_set_cdtext;
burn_session_set_cdtext_par;
burn_session_set_start_tno;
burn_set_messenger;
burn_set_scsi_logging;
burn_set_signal_handling;

View File

@ -593,6 +593,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020198 (FAILURE,HIGH) = CD-TEXT pack file readability problem
0x00020199 (SORRY,HIGH) = Text input file reading aborted
0x0002019a (SORRY,HIGH) = Bad track index number
0x0002019b (SORRY,HIGH) = CD track number exceeds range of 1 to 99
libdax_audioxtr:

View File

@ -4020,7 +4020,7 @@ int mmc_get_write_performance(struct burn_drive *d)
is the eventual duty of the caller.
*/
int mmc_compose_mode_page_5(struct burn_drive *d, struct burn_session *s,
int tno, const struct burn_write_opts *o,
int tnum, const struct burn_write_opts *o,
unsigned char *pd)
{
unsigned char *catalog = NULL;
@ -4154,9 +4154,9 @@ fprintf(stderr, "libburn_EXPERIMENTAL: block_type = %d, pd[4]= %u\n",
/* SCMS at byte 3 bit 4 */
isrc_text[0] = 0;
if (s != NULL && o->write_type == BURN_WRITE_TAO) {
if (tno >= 1 && tno <= s->tracks) {
if (s->track[tno - 1]->isrc.has_isrc) {
isrc = &(s->track[tno - 1]->isrc);
if (tnum >= 0 && tnum < s->tracks) {
if (s->track[tnum]->isrc.has_isrc) {
isrc = &(s->track[tnum]->isrc);
isrc_text[0] = isrc->country[0];
isrc_text[1] = isrc->country[1];
isrc_text[2] = isrc->owner[0];
@ -4166,8 +4166,8 @@ fprintf(stderr, "libburn_EXPERIMENTAL: block_type = %d, pd[4]= %u\n",
(unsigned int) isrc->year,
isrc->serial);
}
if ((s->track[tno - 1]->mode & BURN_SCMS) &&
!(s->track[tno - 1]->mode & BURN_COPY))
if ((s->track[tnum]->mode & BURN_SCMS) &&
!(s->track[tnum]->mode & BURN_COPY))
pd[3] |= 0x10;
}
}

View File

@ -287,8 +287,7 @@ int spc_get_erase_progress(struct burn_drive *d)
BURN_ALLOC_MEM(b, struct buffer, 1);
spc_request_sense(d, b);
/* Now checking the the preconditions as of SPC-3 4.5.2.4.4 and 4.5.3
*/
/* Checking the preconditions as of SPC-3 4.5.2.4.4 and 4.5.3 */
ret = -1;
if (b->data[0] == 0x70 &&
((b->data[2] & 0x0f) == 0 || (b->data[2] & 0x0f) == 2) &&
@ -749,7 +748,7 @@ Write Parameters Mode Page (05h) is MMC (Table 108 in MMC-1).
Thus the filling of the mode page is done by mmc_compose_mode_page_5().
*/
void spc_select_write_params(struct burn_drive *d, struct burn_session *s,
int tno, const struct burn_write_opts *o)
int tnum, const struct burn_write_opts *o)
{
struct buffer *buf = NULL;
struct command *c = NULL;
@ -806,7 +805,7 @@ void spc_select_write_params(struct burn_drive *d, struct burn_session *s,
c->page->bytes = alloc_len;
/* ts A61229 */
if (mmc_compose_mode_page_5(d, s, tno, o, c->page->data + 8) <= 0)
if (mmc_compose_mode_page_5(d, s, tnum, o, c->page->data + 8) <= 0)
goto ex;
c->dir = TO_DRIVE;

View File

@ -88,6 +88,8 @@ struct burn_session *burn_session_create(void)
s = calloc(1, sizeof(struct burn_session));
if (s == NULL) /* ts A70825 */
return NULL;
s->firsttrack = 1;
s->lasttrack = 0;
s->refcnt = 1;
s->tracks = 0;
s->track = NULL;
@ -762,6 +764,27 @@ ex:;
}
/* ts B20107 API */
int burn_session_set_start_tno(struct burn_session *session, int tno, int flag)
{
if (tno < 1 || tno > 99) {
libdax_msgs_submit(libdax_messenger, -1, 0x0002019b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"CD start track number exceeds range of 1 to 99",
0, 0);
return 0;
}
if (tno + session->tracks - 1 > 99) {
libdax_msgs_submit(libdax_messenger, -1, 0x0002019b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"CD track number exceeds 99", 0, 0);
return 0;
}
session->firsttrack = tno;
return 1;
}
struct burn_cdtext *burn_cdtext_create(void)
{
struct burn_cdtext *t;

View File

@ -556,6 +556,13 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
goto failed;
*/
}
if (session->firsttrack + ntr - 1 > 99) {
libdax_msgs_submit(libdax_messenger, -1, 0x0002019b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"CD track number exceeds 99", 0, 0);
goto failed;
}
session->lasttrack = session->firsttrack + ntr - 1;
d->toc_entry = calloc(d->toc_entries, sizeof(struct burn_toc_entry));
e = d->toc_entry;
@ -564,11 +571,11 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
e[0].control = TOC_CONTROL_AUDIO;
else
e[0].control = TOC_CONTROL_DATA;
e[0].pmin = 1;
e[0].pmin = session->firsttrack;
e[0].psec = o->format;
e[0].adr = 1;
e[1].point = 0xA1;
e[1].pmin = ntr;
e[1].pmin = session->lasttrack;
e[1].adr = 1;
if (tar[ntr - 1]->mode & BURN_AUDIO)
e[1].control = TOC_CONTROL_AUDIO;
@ -596,8 +603,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
scms = 0;
if (tar[i]->isrc.has_isrc) {
ret = add_isrc_cue(sheet, ctladr, i + 1,
&(tar[i]->isrc));
ret = add_isrc_cue(sheet, ctladr,
i + session->firsttrack, &(tar[i]->isrc));
if (ret <= 0)
goto failed;
}
@ -621,7 +628,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
if (j == 1) {
tar[i]->entry = &e[3 + i];
e[3 + i].point = i + 1;
e[3 + i].point = i + session->firsttrack;
burn_lba_to_msf(runtime, &m, &s, &f);
e[3 + i].pmin = m;
e[3 + i].psec = s;
@ -638,7 +645,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
/* >>> check index with track size */;
tar[i]->index[j] += runtime;
ret = add_cue(sheet, ctladr | 1, i + 1, j, form, scms,
ret = add_cue(sheet, ctladr | 1,
i + session->firsttrack, j, form, scms,
tar[i]->index[j]);
if (ret <= 0)
goto failed;
@ -649,8 +657,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
#else /* Libburn_track_multi_indeX */
if (i == 0) {
ret = add_cue(sheet, ctladr | 1, 1, 0, form, 0,
runtime);
ret = add_cue(sheet, ctladr | 1, session->firsttrack,
0, form, 0, runtime);
if (ret <= 0)
goto failed;
runtime += 150;
@ -660,8 +668,9 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
be to compare tar[]->mode or bit2 of ctladr.
*/
ret = add_cue(sheet, ctladr | 1, i + 1, 0, form, scms,
runtime);
ret = add_cue(sheet, ctladr | 1,
i + session->firsttrack, 0, form, scms,
runtime);
if (ret <= 0)
goto failed;
@ -693,7 +702,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
/* XXX HERE IS WHERE WE DO INDICES IN THE CUE SHEET */
/* XXX and we should make sure the gaps conform to ecma-130... */
tar[i]->entry = &e[3 + i];
e[3 + i].point = i + 1;
e[3 + i].point = i + session->firsttrack;
burn_lba_to_msf(runtime, &m, &s, &f);
e[3 + i].pmin = m;
e[3 + i].psec = s;
@ -701,8 +710,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
e[3 + i].adr = 1;
e[3 + i].control = type_to_ctrl(tar[i]->mode);
ret = add_cue(sheet, ctladr | 1, i + 1, 1, form, scms,
runtime);
ret = add_cue(sheet, ctladr | 1, i + session->firsttrack,
1, form, scms, runtime);
if (ret <= 0)
goto failed;
@ -1084,7 +1093,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
{ ret = 0; goto ex; }
} else {
o->control = t->entry->control;
d->send_write_parameters(d, s, tnum + 1, o);
d->send_write_parameters(d, s, tnum, o);
/* ts A61103 */
ret = d->get_nwa(d, -1, &lba, &nwa);
@ -1425,7 +1434,7 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o,
off_t size;
BURN_ALLOC_MEM(msg, char, 160);
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg,
"DVD pre-track %2.2d : get_nwa(%d), ret= %d , d->nwa= %d",
@ -2096,7 +2105,7 @@ int burn_disc_setup_dvd_minus_rw(struct burn_write_opts *o,
5.4.14 finally states that profile 0013h includes feature
002Ch rather than 0026h.
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
*/
d->busy = BURN_DRIVE_FORMATTING;
@ -2852,7 +2861,7 @@ return crap. so we send the command, then ignore the result.
s = disc->session[0];
else
s = NULL;
d->send_write_parameters(d, s, 0, o);
d->send_write_parameters(d, s, -1, o);
ret = d->get_nwa(d, -1, &lba, &nwa);
sprintf(msg,
@ -3174,7 +3183,7 @@ int burn_disc_close_damaged(struct burn_write_opts *o, int flag)
o->write_type = BURN_WRITE_TAO; /* no action without TAO */
/* Send mode page 5 */;
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
ret = burn_write_close_session(o);
if (ret <= 0)
@ -3185,7 +3194,7 @@ int burn_disc_close_damaged(struct burn_write_opts *o, int flag)
o->write_type = BURN_WRITE_TAO; /* no action without TAO */
/* Send mode page 5 */;
d->send_write_parameters(d, NULL, 0, o);
d->send_write_parameters(d, NULL, -1, o);
ret = burn_disc_close_track_dvd_minus_r(o, 0);
if (ret <= 0)