New API call burn_write_opts_set_obs_pad()

This commit is contained in:
Thomas Schmitt 2012-04-08 11:26:35 +00:00
parent 31a4d2c1e1
commit 529c4a2d2e
7 changed files with 57 additions and 16 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.04.04.183902" #define Cdrskin_timestamP "2012.04.08.112703"

View File

@ -3079,6 +3079,17 @@ void burn_write_opts_set_stream_recording(struct burn_write_opts *opts,
*/ */
void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs); void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs);
/* ts B20406 */
/** Overrides the automatic decision whether to pad up the last write chunk to
its full size. This applies to DVD, BD and stdio: pseudo-drives.
@param opts The write opts to change
@param pad 1 means to pad up in any case, 0 means automatic decision.
@since 1.2.4
*/
void burn_write_opts_set_obs_pad(struct burn_write_opts *opts, int pad);
/* ts A91115 */ /* ts A91115 */
/** Sets the rythm by which stdio pseudo drives force their output data to /** Sets the rythm by which stdio pseudo drives force their output data to
be consumed by the receiving storage device. This forcing keeps the memory be consumed by the receiving storage device. This forcing keeps the memory

View File

@ -176,6 +176,7 @@ burn_write_opts_set_has_mediacatalog;
burn_write_opts_set_leadin_text; burn_write_opts_set_leadin_text;
burn_write_opts_set_mediacatalog; burn_write_opts_set_mediacatalog;
burn_write_opts_set_multi; burn_write_opts_set_multi;
burn_write_opts_set_obs_pad;
burn_write_opts_set_perform_opc; burn_write_opts_set_perform_opc;
burn_write_opts_set_simulate; burn_write_opts_set_simulate;
burn_write_opts_set_start_byte; burn_write_opts_set_start_byte;

View File

@ -411,6 +411,7 @@ Range "libdax_msgs" : 0x00000000 to 0x0000ffff
0x00000001 (DEBUG,ZERO) = Test error message 0x00000001 (DEBUG,ZERO) = Test error message
0x00000002 (DEBUG,ZERO) = Debugging message 0x00000002 (DEBUG,ZERO) = Debugging message
0x00000003 (FATAL,HIGH) = Out of virtual memory 0x00000003 (FATAL,HIGH) = Out of virtual memory
0x00000004 (FATAL,HIGH) = Generic fatal error
------------------------------------------------------------------------------ ------------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2012 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -480,6 +480,13 @@ void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs)
} }
/* ts B20406: API */
void burn_write_opts_set_obs_pad(struct burn_write_opts *opts, int pad)
{
opts->obs_pad = 2 * !!pad;
}
/* ts A91115: API */ /* ts A91115: API */
void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm) void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm)
{ {

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2012 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -42,7 +42,9 @@ struct burn_write_opts
/* ts A61219 : Output block size to trigger buffer flush if hit. /* ts A61219 : Output block size to trigger buffer flush if hit.
-1 with CD, 32 kB with DVD */ -1 with CD, 32 kB with DVD */
int obs; int obs;
int obs_pad; /* 1=pad up last block to obs */ int obs_pad; /* >0 pad up last block to obs, 0 do not
2 indicates burn_write_opts_set_obs_pad(,1)
*/
/* ts A61222 : Start address for media which allow a choice */ /* ts A61222 : Start address for media which allow a choice */
off_t start_byte; off_t start_byte;

View File

@ -1597,15 +1597,29 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
if (o->write_type == BURN_WRITE_SAO && if (o->write_type == BURN_WRITE_SAO &&
! burn_track_is_open_ended(s->track[tnum])) { ! burn_track_is_open_ended(s->track[tnum])) {
/* Round track size up to write chunk size and reserve track */ /* Reserve track */
size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1)) size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1))
* (off_t) 2048; * (off_t) 2048;
/* o->obs should be 32k or 64k already. But 32k alignment if (o->obs_pad) {
was once performed in d->reserve_track() */ /* Round track size up to write chunk size */
/* o->obs should be 32k or 64k already. But 32k
alignment was once performed in d->reserve_track()*/
if (o->obs % 32768) if (o->obs % 32768)
o->obs += 32768 - (o->obs % 32768); o->obs += 32768 - (o->obs % 32768);
if (size % o->obs) if (size % o->obs)
size += (off_t) (o->obs - (size % o->obs)); size += (off_t) (o->obs - (size % o->obs));
}
/* <<< Only for now until the first DVD+R succeeded */
if (!o->obs_pad) {
sprintf(msg, "Program error: encountered DVD+R without chunk padding");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000004,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
{ret = 0; goto ex;}
}
ret = d->reserve_track(d, size); ret = d->reserve_track(d, size);
if (ret <= 0) { if (ret <= 0) {
sprintf(msg, "Cannot reserve track of %.f bytes", sprintf(msg, "Cannot reserve track of %.f bytes",
@ -2280,10 +2294,12 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0); msg, 0, 0);
} }
o->obs_pad = 0; /* no filling-up of track's last 32k buffer */ if (o->obs_pad < 2)
o->obs_pad = 0; /* no filling-up of last 32k buffer */
if (d->current_profile == 0x43) /* BD-RE */ if (d->current_profile == 0x43) /* BD-RE */
o->obs = Libburn_bd_re_obS; o->obs = Libburn_bd_re_obS;
if (d->do_stream_recording) { if (d->do_stream_recording) {
if (o->obs_pad < 2)
o->obs_pad = 1; o->obs_pad = 1;
if (d->current_profile == 0x43) /* BD-RE */ if (d->current_profile == 0x43) /* BD-RE */
o->obs = Libburn_bd_re_streamed_obS; o->obs = Libburn_bd_re_streamed_obS;
@ -2321,6 +2337,7 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
burn_track_set_size(t, default_size); burn_track_set_size(t, default_size);
} }
/* Whether to fill-up last 32k buffer of track. */ /* Whether to fill-up last 32k buffer of track. */
if (o->obs_pad < 2)
o->obs_pad = (o->write_type != BURN_WRITE_SAO); o->obs_pad = (o->write_type != BURN_WRITE_SAO);
ret = burn_disc_setup_dvd_minus_r(o, disc); ret = burn_disc_setup_dvd_minus_r(o, disc);
if (ret <= 0) { if (ret <= 0) {
@ -2362,6 +2379,7 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
goto early_failure; goto early_failure;
} }
/* ??? padding needed ??? cowardly doing it for now */ /* ??? padding needed ??? cowardly doing it for now */
if (o->obs_pad < 2)
o->obs_pad = 1; /* fill-up track's last 32k buffer */ o->obs_pad = 1; /* fill-up track's last 32k buffer */
if (d->do_stream_recording) { if (d->do_stream_recording) {
if (d->current_profile == 0x41) /* BD-R */ if (d->current_profile == 0x41) /* BD-R */
@ -2777,6 +2795,7 @@ int burn_stdio_write_sync(struct burn_write_opts *o,
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
d->needs_close_session = 0; d->needs_close_session = 0;
if (o->obs_pad < 2)
o->obs_pad = 0; /* no filling-up of track's last 32k buffer */ o->obs_pad = 0; /* no filling-up of track's last 32k buffer */
o->obs = 32*1024; /* buffer size */ o->obs = 32*1024; /* buffer size */