Made use of formatting of DVD-RW

This commit is contained in:
Thomas Schmitt 2007-01-01 17:19:41 +00:00
parent f505c56896
commit d3298fd2ea
6 changed files with 205 additions and 61 deletions

View File

@ -9,7 +9,7 @@ This all is under GPL.
Based on and sub project of:
libburnia.pykix.org
By Mario Danic <mario.danic@gmail.com> and Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2006 Mario Danic, Thomas Schmitt
Copyright (C) 2006-2007 Mario Danic, Thomas Schmitt
libburnia.pykix.org is inspired by and in other components still containing
parts of
@ -27,7 +27,7 @@ cdrskin. By Thomas Schmitt <scdbackup@gmx.net>
Integrated sub project of libburnia.pykix.org but also published via:
http://scdbackup.sourceforge.net/cdrskin_eng.html
http://scdbackup.sourceforge.net/cdrskin-0.2.7.tar.gz
Copyright (C) 2006 Thomas Schmitt
Copyright (C) 2006-2007 Thomas Schmitt
------------------------------------------------------------------------------
@ -164,11 +164,11 @@ Thoroughly blank a CD-RW
Blank CD-RW sufficiently for making it ready for overwrite
cdrskin -v dev=0,1,0 blank=fast -eject
Burn image file my_image.iso to CD or DVD+RW
Burn image file my_image.iso to CD or DVD+-RW
cdrskin -v dev=0,1,0 speed=12 fs=8m driveropts=burnfree padsize=300k \
-eject my_image.iso
Burn a compressed afio archive to CD or DVD+RW on-the-fly
Burn a compressed afio archive to CD or DVD+-RW on-the-fly
find . | afio -oZ - | cdrskin -v dev=0,1,0 fs=32m speed=8 -tao \
driveropts=burnfree padsize=300k -
@ -212,7 +212,7 @@ Many cdrecord options are still unsupported, though.
If you have use cases for them, please report your wishes and expectations.
DVD support is still immature and restricted to DVD+RW for now.
DVD support is still immature and restricted to DVD+-RW for now.
@ -399,6 +399,25 @@ into the format of the burned data. Be advised to use growisofs for the
task of maintaining extendable ISO-Filesystems on DVD+RW.
DVD-RW
DVD-RW are usable if formatted to state "Restricted Overwrite". They then
behave much like DVD+RW. See above.
DVD-RW in state "Sequential" have first to be formatted by
cdrskin dev=... -v blank=format_overwrite
"Sequential" is the state of unused media and of media previously blanked
or written by cdrecord. dvd+rw-format -blank can also achieve this state.
(Command dvd+rw-format -force can achieve "Restricted Overwrite".)
Formatting or first use of freshly formatted DVD-RW can produce unusual noises
from the drive and last several minutes. Depending on mutual compatibility of
drive and media, formatting can yield unusable media. I finally always got
them revived again by help of: cdrecord-2.01.01a23 dev=... -v blank=fast
After some tries, they got converted into state "Sequential" from where a
new try could be made to get them reliably into state "Restricted Overwrite".
(A similar sequential blank feature with cdrskin is still to come.)
Special compilation variations
You may get a (super fat) statically linked binary by :

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 "December 16, 2006"
.TH CDRSKIN 1 "January 1, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -88,7 +88,7 @@ cdrskin is able to fulfill the needs about their option -C.
.br
Another type of data track content are archive formats which originally
have been developed for magnetic tapes. Only formats which mark a detectable
end-of-archive in their data are suitable with CD, though. Well tested are
end-of-archive in their data are suitable, though. Well tested are
the archivers afio and star. Not suitable seems GNU tar.
.PP
.B Recordable CD Media:
@ -98,19 +98,30 @@ get closed (or are spoiled because they are overly full). After that they are
read-only.
.br
CD-RW media can be blanked to make them re-usable for another
round of overwriting. Blanking damages the previous content but does not
round of overwriting. Usually
.B blank=fast
is the appropriate option.
Blanking damages the previous content but does not
make it completely unreadable. It is no effective privacy precaution.
Multiple cycles of blanking and overwriting with random numbers might be.
.PP
.B Recordable DVD Media:
.br
Currently only type DVD+RW can be burned via cdrskin.
Currently only types DVD+RW and DVD-RW can be burned via cdrskin.
.br
DVD+RW media get treated as blank media regardless wether they hold data
or not. Options -audio and -multi are not allowed. Only one track is allowed.
-toc does not return information about the media content.
Speed is counted in DVD units (i.e. 1x = 1,385,000 bytes/second). Currently
there is no difference between -sao and -tao. If ever, then -tao will be the
mode which preserves the current behavior.
.br
DVD-RW need to be formatted to state "Restricted Overwrite". They then behave
much like CD-RW. This formatting can be done by option
.B blank=format_overwrite
It is necessary for unused media, for media written or blanked by cdrecord,
for media which have been written unformatted by growisofs or blanked by
dvd+rw-format -blank. If in doubt, just give it a try.
.PP
.B Drive preparation and addressing:
.br
@ -172,7 +183,8 @@ those parameters and eventually raw audio data get extracted and burned as
audio track. Same is done for suffix .au and SUN Audio.
.TP
.BI blank= type
Blank a CD-RW disc. This is combinable with burning in the same run of cdrskin.
Blank a CD-RW or format a DVD-RW.i
This is combinable with burning in the same run of cdrskin.
The type given with blank= selects the particular behavior:
.RS
.TP
@ -180,10 +192,13 @@ help
Print this list of blanking types.
.TP
all
Blank the entire disk.
Blank an entire CD.
.TP
fast
Minimally blank the entire disk.
Minimally blank an entire CD.
.TP
format_overwrite
Format a DVD-RW to "Restricted Overwrite".
.RE
.TP
.BI \-checkdrive
@ -444,8 +459,9 @@ interpretation of eventual startup files. See section FILES below.
Accept only the last argument of the command line as track source address.
.TP
.BI write_start_address= byte_offset
Set the address on media where to start writing the track. DVD+RW only for
now. byte_offset must be aligned to 2 KB blocks. Better is 32 kB alignment.
Set the address on media where to start writing the track. With DVD+RW
byte_offset must be aligned to 2 KB blocks. With DVD-RW alignment is 32 kB.
Other media are not suitable for this option yet.
.PP
Alphabetical list of options which are only intended for very special
situations and not for normal use:
@ -557,6 +573,10 @@ cdrskin -v dev=/dev/sg1 blank=all -eject
.br
cdrskin -v dev=/dev/dvd blank=fast -eject
.SS
.B Format DVD-RW before first use with cdrskin:
.br
cdrskin -v dev=/dev/sr0 blank=format_overwrite
.SS
.B Write ISO-9660 filesystem image:
.br
cdrskin -v dev=/dev/hdc speed=12 fs=8m \\

View File

@ -1,6 +1,6 @@
/*
cdrskin.c , Copyright 2006 Thomas Schmitt <scdbackup@gmx.net>
cdrskin.c , Copyright 2006-2007 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL. See future commitment below.
A cdrecord compatible command line interface for libburn.
@ -171,6 +171,7 @@ or
#define Cdrskin_libburn_has_set_start_bytE 1
#define Cdrskin_libburn_has_wrote_welL 1
#define Cdrskin_libburn_has_bd_formattinG 1
#define Cdrskin_libburn_has_burn_disc_formaT 1
#endif /* Cdrskin_libburn_0_2_7 */
#ifndef Cdrskin_libburn_versioN
@ -1826,6 +1827,8 @@ return:
"\tfast\t\tminimally blank the entire disk\n");
fprintf(stderr,
"\tminimal\t\tminimally blank the entire disk\n");
fprintf(stderr,
"\tformat_overwrite\tformat a DVD-RW to \"Restricted Overwrite\"\n");
#else /* ! Cdrskin_extra_leaN */
@ -2374,6 +2377,8 @@ struct CdrskiN {
int do_blank;
int blank_fast;
int no_blank_appendable;
int blank_format_type; /* 0=blank, 1 to 255 like with burn_disc_format(flag):
1=format_overwrite, 2=format_sequential */
int do_burn;
int burnfree;
@ -2497,6 +2502,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
o->do_blank= 0;
o->blank_fast= 0;
o->no_blank_appendable= 0;
o->blank_format_type= 0;
o->do_burn= 0;
o->write_type= BURN_WRITE_SAO;
o->block_type= BURN_BLOCK_SAO;
@ -3834,7 +3840,9 @@ ex:;
bit0= do not print message about pseudo-checkdrive
*/
int Cdrskin_wait_before_action(struct CdrskiN *skin, int flag)
/* flag: bit0= BLANK rather than write mode */
/* flag: bit0= BLANK rather than write mode
bit1= FORMAT rather than write mode
*/
{
int i;
@ -3849,7 +3857,7 @@ int Cdrskin_wait_before_action(struct CdrskiN *skin, int flag)
printf(
"Starting to write CD/DVD at speed %s in %s %s mode for %s session.\n",
speed_text,(skin->dummy_mode?"dummy":"real"),
(flag&1?"BLANK":skin->preskin->write_mode_name),
(flag&2?"FORMAT":(flag&1?"BLANK":skin->preskin->write_mode_name)),
(skin->multi?"multi":"single"));
printf("Last chance to quit, starting real write in %3d seconds.",
skin->gracetime);
@ -3878,8 +3886,14 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
enum burn_disc_status s;
struct burn_progress p;
struct burn_drive *drive;
int ret,loop_counter= 0,hint_force= 0;
int ret,loop_counter= 0,hint_force= 0,do_format= 0, profile_number= -1;
int wrote_well= 1;
double start_time;
char *verb= "format", *presperf="blanking", *fmt_text= "format_...";
char profile_name[80];
static char fmtp[][40]= {
"format_default", "format_overwrite", "format_sequential"};
static int fmtp_max= 2;
start_time= Sfile_microtime(0); /* will be refreshed later */
ret= Cdrskin_grab_drive(skin,0);
@ -3896,8 +3910,19 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
s= burn_disc_get_status(drive);
#endif
profile_name[0]= 0;
#ifdef Cdrskin_libburn_has_get_profilE
if(skin->grabbed_drive)
burn_disc_get_profile(skin->grabbed_drive,&profile_number,profile_name);
#endif
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);
do_format= skin->blank_format_type;
if(do_format) {
verb= "format";
presperf= "formatting";
}
#ifdef Cdrskin_libburn_has_pretend_fulL
if(s==BURN_DISC_UNSUITABLE) {
@ -3911,44 +3936,103 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
}
#endif /* Cdrskin_libburn_has_pretend_fulL */
if(s!=BURN_DISC_FULL &&
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) {
Cdrskin_release_drive(skin,0);
if(s==BURN_DISC_BLANK) {
if(do_format) {
if(do_format>=0 && do_format<=fmtp_max)
fmt_text= fmtp[do_format];
if(do_format!=1) {
/* >>> other formats to come. At least _sequential */;
fprintf(stderr,
"cdrskin: NOTE : blank=... : media was already blank (and still is)\n");
return(2);
} else if(s==BURN_DISC_APPENDABLE) {
fprintf(stderr,
"cdrskin: FATAL : blank=... : media is still appendable\n");
"cdrskin: SORRY : only blank=%s is implemented yet\n",fmtp[1]);
return(0);
} else if(profile_number == 0x14) { /* DVD-RW sequential */
if(do_format!=2 && do_format!=1)
goto unsupported_with_dvd_minus_rw;
} else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */
if(do_format==2) { /* >>> when re-formatting is implemented:
|| (do_format==1 && skin->force_is_set) */
;
} else if(do_format!=1) {
unsupported_with_dvd_minus_rw:;
fprintf(stderr,
"cdrskin: SORRY : blank=%s : unsupported format type with DVD-RW\n",
fmt_text);
return(0);
} else {
fprintf(stderr,
"cdrskin: SORRY : blank=format_overwrite : media is already formatted\n");
/* >>> when re-formatting is implemented
fprintf(stderr,
"cdrskin: HINT : If you really want to re-format, try option -force\n");
*/
return(2);
}
} else {
fprintf(stderr,
"cdrskin: FATAL : blank=... : no blankworthy disc found\n");
if(hint_force)
fprintf(stderr,
"cdrskin: HINT : If you are certain to have a CD-RW, try option -force\n");
"cdrskin: SORRY : blank=%s for now does DVD-RW only\n",fmt_text);
return(0);
}
if(s==BURN_DISC_UNSUITABLE)
fprintf(stderr,
"cdrskin: NOTE : blank=%s accepted not yet suitable media\n",
fmt_text);
} else {
if(s!=BURN_DISC_FULL &&
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) {
Cdrskin_release_drive(skin,0);
if(s==BURN_DISC_BLANK) {
fprintf(stderr,
"cdrskin: NOTE : blank=... : media was already blank (and still is)\n");
return(2);
} else if(s==BURN_DISC_APPENDABLE) {
fprintf(stderr,
"cdrskin: FATAL : blank=... : media is still appendable\n");
} else {
fprintf(stderr,
"cdrskin: FATAL : blank=... : no blankworthy disc found\n");
if(hint_force)
fprintf(stderr,
"cdrskin: HINT : If you are certain to have a CD-RW, try option -force\n");
}
return(0);
}
if(!burn_disc_erasable(drive)) {
fprintf(stderr,"cdrskin: FATAL : blank=... : media is not erasable\n");
return(0);
}
return(0);
}
if(!burn_disc_erasable(drive)) {
fprintf(stderr,
"cdrskin: FATAL : blank=... : media is not erasable\n");
return(0);
}
if(skin->dummy_mode) {
fprintf(stderr,
"cdrskin: would have begun to blank disc if not in -dummy mode\n");
"cdrskin: would have begun to %s disc if not in -dummy mode\n",
verb);
goto blanking_done;
}
fprintf(stderr,"cdrskin: beginning to blank disc\n");
fprintf(stderr,"cdrskin: beginning to %s disc\n",verb);
Cdrskin_adjust_speed(skin,0);
#ifndef Cdrskin_extra_leaN
Cdrskin_wait_before_action(skin,1);
Cdrskin_wait_before_action(skin,1+(!!do_format));
#endif /* ! Cdrskin_extra_leaN */
skin->drive_is_busy= 1;
burn_disc_erase(drive,skin->blank_fast);
if(do_format==0) {
burn_disc_erase(drive,skin->blank_fast);
#ifdef Cdrskin_libburn_has_burn_disc_formaT
} else if(do_format==1) {
burn_disc_format(drive,0);
#endif
} else {
/* >>> */;
/* <<< */
fprintf(stderr,"cdrskin: SORRY : Format type %d not implemented yet.\n",
do_format);
ret= 0; goto ex;
}
loop_counter= 0;
start_time= Sfile_microtime(0);
@ -3960,22 +4044,33 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
if(p.sectors>0) /* i want a display of 1 to 99 percent */
percent= 1.0+((double) p.sector+1.0)/((double) p.sectors)*98.0;
fprintf(stderr,
"\rcdrskin: blanking ( done %2d%% , %lu seconds elapsed ) ",
percent,(unsigned long) (Sfile_microtime(0)-start_time));
"\rcdrskin: %s ( done %2d%% , %lu seconds elapsed ) ",
presperf,percent,(unsigned long) (Sfile_microtime(0)-start_time));
}
sleep(1);
loop_counter++;
}
blanking_done:;
skin->drive_is_busy= 0;
if(skin->verbosity>=Cdrskin_verbose_progresS) {
#ifdef Cdrskin_libburn_has_wrote_welL
wrote_well = burn_drive_wrote_well(drive);
#endif
if(wrote_well && skin->verbosity>=Cdrskin_verbose_progresS) {
fprintf(stderr,
"\rcdrskin: blanking done \n");
printf("Blanking time: %.3fs\n",Sfile_microtime(0)-start_time);
fflush(stdout);
"\rcdrskin: %s done \n",
presperf);
printf("%s time: %.3fs\n",(do_format?"Formatting":"Blanking"),
Sfile_microtime(0)-start_time);
}
fflush(stdout);
if(!wrote_well)
fprintf(stderr,
"\rcdrskin: %s failed \n",
presperf);
ret= !!(wrote_well);
ex:;
skin->drive_is_busy= 0;
Cdrskin_release_drive(skin,0);
return(1);
return(ret);
}
@ -4887,7 +4982,7 @@ int Cdrskin_setup(struct CdrskiN *skin, int argc, char **argv, int flag)
{
int i,k,ret,source_has_size=0;
double value,grab_and_wait_value= -1.0;
char *cpt,*value_pt,adr[Cdrskin_adrleN];
char *cpt,*value_pt,adr[Cdrskin_adrleN],*blank_mode= "";
struct stat stbuf;
/* cdrecord 2.01 options which are not scheduled for implementation, yet */
@ -5014,23 +5109,33 @@ set_abort_max_wait:;
} else if(strncmp(argv[i],"blank=",6)==0) {
cpt= argv[i]+6;
set_blank:;
skin->blank_format_type= 0;
blank_mode= cpt;
if(strcmp(cpt,"all")==0 || strcmp(cpt,"disc")==0
|| strcmp(cpt,"disk")==0) {
skin->do_blank= 1;
skin->blank_fast= 0;
blank_mode= "all";
} else if(strcmp(cpt,"fast")==0 || strcmp(cpt,"minimal")==0) {
skin->do_blank= 1;
skin->blank_fast= 1;
blank_mode= "fast";
} else if(strcmp(cpt,"format_overwrite")==0) {
skin->do_blank= 1;
skin->blank_format_type= 1;
} else if(strcmp(cpt,"format_sequential")==0) {
skin->do_blank= 1;
skin->blank_format_type= 2;
} else if(strcmp(cpt,"help")==0) {
/* is handled in Cdrpreskin_setup() */;
continue;
} else {
fprintf(stderr,"cdrskin: FATAL : blank option '%s' not supported yet\n",
cpt);
return(0);
}
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: blank mode : blank=%s\n",
(skin->blank_fast?"fast":"all"));
printf("cdrskin: blank mode : blank=%s\n",blank_mode);
} else if(strcmp(argv[i],"--bragg_with_audio")==0) {
/* OBSOLETE 0.2.3 : was handled in Cdrpreskin_setup() */;

View File

@ -231,6 +231,7 @@ Enhancements towards previous stable version cdrskin-0.2.4:
<LI>Detailed man page (already backported to cdrskin-0.2.6.pl02)</LI>
<LI>Burning to DVD+RW as non-multi, non-appending, single-track session</LI>
<LI>Emulation of new wodim option msifile=path</LI>
<LI>Formatting and then burning to DVD-RW like to DVD+RW</LI>
</UL>
</DD>
<DD>&nbsp;</DD>

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.01.01.170824"
#define Cdrskin_timestamP "2007.01.01.171725"

View File

@ -23,8 +23,10 @@ Appending sessions to an unclosed CD is restricted to write mode TAO.
(Users who have a burner which succeeds with a follow-up session via
cdrecord -sao : please contact us.)
cdrskin does not provide DVD burning yet. See advise to use dvd+rw-tools
at the end of this text.
The development version of cdrskin is able to burn a single track to DVD+RW
or DVD-RW media.
For other DVD types and for appending sessions to ISO filesystems see the
advise to use dvd+rw-tools at the end of this text.
--------------------------------------------------------------------------
@ -191,12 +193,9 @@ They are not compatible or related to cdrecord resp. cdrecord-ProDVD
(now obsoleted by original source cdrtools cdrecord with identical
capabilities besides the license key).
If there is sincere and well motivated interest, the cdrskin project could try
to employ growisofs as DVD burning engine. The cdrskin project would prefer to
wait for DVD support being included in libburn, though.
A very limited and specialized cdrecord-compatibility wrapper for growisofs
serves in my project scdbackup. It is not overly hard to make one that serves
some very few fixed use cases.
libburn and thus the cdrskin project are currently aquiring own capabilities
to burn to DVD media. For now restricted to DVD+RW and DVD-RW and to single
tracks.
To my knowledge, Linux kernels 2.6 do write to DVD+RW via block devices as
they would write to a traditional tape device. Try old tape archiver