Adjustable write position for DVD+RW: burn_write_opts_set_start_byte()

This commit is contained in:
Thomas Schmitt 2006-12-23 10:20:35 +00:00
parent 1ae27b6afc
commit 639aad3571
5 changed files with 57 additions and 11 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.12.21.214641" #define Cdrskin_timestamP "2006.12.23.102056"

View File

@ -765,7 +765,7 @@ struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive);
void burn_write_opts_free(struct burn_write_opts *opts); void burn_write_opts_free(struct burn_write_opts *opts);
/** Creates a read_opts struct for reading from the specified drive /** Creates a read_opts struct for reading from the specified drive
must be freed with burn_write_opts_free must be freed with burn_read_opts_free
@param drive The drive to read from @param drive The drive to read from
@return The read_opts @return The read_opts
*/ */
@ -1062,13 +1062,26 @@ void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, unsigned cha
/* ts A61106 */ /* ts A61106 */
/* Sets the multi flag which eventually marks the emerging session as not being /** Sets the multi flag which eventually marks the emerging session as not
the last one and thus creating a BURN_DISC_APPENDABLE media. being the last one and thus creating a BURN_DISC_APPENDABLE media.
@param multi 1=media will be appendable, 0=media will be closed (default) @param multi 1=media will be appendable, 0=media will be closed (default)
*/ */
void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi); void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi);
/* ts A61222 */
/** Sets a start address for writing to media and write modes which allow to
choose this address at all (DVD+RW only for now). The address is given in
bytes. If it is not -1 then a write run will fail if choice of start
address is not supported or if the block alignment of the address is not
suitable for media and write mode. (Alignment to 32 kB blocks is advised
with DVD media.)
@param opts The write opts to change
@param value The address in bytes (-1 = start at default address)
*/
void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value);
/** Sets whether to read in raw mode or not /** Sets whether to read in raw mode or not
@param opts The read opts to change @param opts The read opts to change
@param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the

View File

@ -33,6 +33,7 @@ struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive)
opts->underrun_proof = drive->mdata->underrun_proof; opts->underrun_proof = drive->mdata->underrun_proof;
opts->perform_opc = 1; opts->perform_opc = 1;
opts->obs = -1; opts->obs = -1;
opts->start_byte = 0;
opts->has_mediacatalog = 0; opts->has_mediacatalog = 0;
opts->format = BURN_CDROM; opts->format = BURN_CDROM;
opts->multi = 0; opts->multi = 0;
@ -153,6 +154,7 @@ void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts,
memcpy(opts->mediacatalog, &mediacatalog, 13); memcpy(opts->mediacatalog, &mediacatalog, 13);
} }
/* ts A61106 */ /* ts A61106 */
void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi) void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi)
{ {
@ -160,6 +162,12 @@ void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi)
} }
/* ts A61222 */
void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value)
{
opts->start_byte = value;
}
void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw) void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw)
{ {

View File

@ -37,6 +37,9 @@ struct burn_write_opts
-1 with CD, 32 kB with DVD */ -1 with CD, 32 kB with DVD */
int obs; int obs;
/* ts A61222 : Start address for media which allow a choice */
off_t start_byte;
/** A disc can have a media catalog number */ /** A disc can have a media catalog number */
int has_mediacatalog; int has_mediacatalog;
unsigned char mediacatalog[13]; unsigned char mediacatalog[13];

View File

@ -909,6 +909,7 @@ int burn_disc_setup_dvd_plus_rw(struct burn_write_opts *o,
{ {
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
int ret; int ret;
char msg[160];
if (d->bg_format_status==0 || d->bg_format_status==1) { if (d->bg_format_status==0 || d->bg_format_status==1) {
/* start or re-start dvd_plus_rw formatting */ /* start or re-start dvd_plus_rw formatting */
@ -916,14 +917,18 @@ int burn_disc_setup_dvd_plus_rw(struct burn_write_opts *o,
if (ret <= 0) if (ret <= 0)
return 0; return 0;
} }
d->nwa = 0;
if (o->start_byte >= 0)
d->nwa = o->start_byte / 2048;
/* >>> Set speed */; sprintf(msg, "Write start address is %d * 2048\n", d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020127,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
/* >>> perform OPC if needed */; /* >>> perform OPC if needed */;
d->nwa = 0;
/* >>> d->get_nwa() (default to 0) */;
/* >>> ? what else ? */; /* >>> ? what else ? */;
return 1; return 1;
@ -977,6 +982,15 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0,0); msg, 0,0);
goto early_failure; goto early_failure;
} }
if (o->start_byte >= 0 && (o->start_byte % 2048)) {
sprintf(msg,
"Write start address not properly aligned to 2048");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020125,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
goto early_failure;
}
} else { } else {
sprintf(msg, "Unsuitable media detected. Profile %4.4Xh %s", sprintf(msg, "Unsuitable media detected. Profile %4.4Xh %s",
@ -987,7 +1001,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0,0); msg, 0,0);
goto early_failure; goto early_failure;
} }
o->obs = 32*1024; /* buffer flush trigger for sector.c:get_sector() */ o->obs = 32*1024; /* buffer flush trigger for sector.c:get_sector() */
burn_disc_init_write_status(o, disc); burn_disc_init_write_status(o, disc);
@ -1017,7 +1030,6 @@ early_failure:;
pthread_mutex_lock(&d->access_lock); pthread_mutex_lock(&d->access_lock);
d->cancel = 1; d->cancel = 1;
pthread_mutex_unlock(&d->access_lock); pthread_mutex_unlock(&d->access_lock);
usleep(500001); /* to avoid a warning from remove_worker() */
return 0; return 0;
} }
@ -1048,6 +1060,15 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
return; return;
} }
if (o->start_byte >= 0) {
sprintf(msg, "Write start address not supported");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020124,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
goto fail_wo_sync;
}
burn_print(1, "sync write of %d CD sessions\n", disc->sessions); burn_print(1, "sync write of %d CD sessions\n", disc->sessions);
/* Apparently some drives require this command to be sent, and a few drives /* Apparently some drives require this command to be sent, and a few drives
@ -1181,6 +1202,7 @@ return crap. so we send the command, then ignore the result.
fail: fail:
d->sync_cache(d); d->sync_cache(d);
fail_wo_sync:; fail_wo_sync:;
usleep(500001); /* ts A61222: to avoid a warning from remove_worker()*/
burn_print(1, "done - failed\n"); burn_print(1, "done - failed\n");
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010b, libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010b,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,