From a54113267e80e1c6764107996daf0def39318c0a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 6 May 2008 18:08:04 +0000 Subject: [PATCH] Declared BD-RE to be supported --- cdrskin/cdrskin_timestamp.h | 2 +- doc/comments | 12 ++++---- doc/cookbook.txt | 8 +++--- libburn/drive.c | 7 +++-- libburn/libburn.h | 5 ++-- libburn/mmc.c | 6 ++-- test/libburner.c | 55 ++++++++++++++++++++++++++----------- 7 files changed, 59 insertions(+), 36 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 614fb93..63b5bfc 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.05.06.084156" +#define Cdrskin_timestamP "2008.05.06.180813" diff --git a/doc/comments b/doc/comments index d64da25..bdc2e01 100644 --- a/doc/comments +++ b/doc/comments @@ -7,10 +7,12 @@ Libburnia is an open-source project for reading, mastering and writing optical discs. -For now this means CD-R, CD-RW, DVD-RAM, DVD+RW, DVD+R, DVD+R/DL, DVD-RW, DVD-R. +For now this means CD-R, CD-RW, DVD-RAM, DVD+RW, DVD+R, DVD+R/DL, DVD-RW, +DVD-R, BD-RE. -Not supported yet are DVD-R/DL, HD-DVD, BD (blue ray). Testers for -BD and DVD-R/DL are wanted, though. +Not supported yet are DVD-R/DL, HD-DVD, BD-R (blue ray). Testers for +DVD-R/DL are wanted, though. BD-R programming efforts would be made +if an interested tester contacts us. The project comprises of several more or less interdependent parts which together strive to be a usable foundation for application development. @@ -57,8 +59,8 @@ composition, updating and writing. Quite unique in the Linux world. cdrecord is a powerful GPL'ed burn program included in Joerg Schilling's cdrtools. cdrskin strives to be a second source for the services traditionally provided by cdrecord. Additionally it - provides libburn's DVD capabilities, where only -sao is compatible - with cdrecord. + provides libburn's DVD/BD capabilities, where only -sao is + compatible with cdrecord. cdrskin does not contain any bytes copied from cdrecord's sources. Many bytes have been copied from the message output of cdrecord runs, though. diff --git a/doc/cookbook.txt b/doc/cookbook.txt index a2a6649..deb8a67 100644 --- a/doc/cookbook.txt +++ b/doc/cookbook.txt @@ -3,7 +3,7 @@ libburnia-project.org Optical Media Rotisserie Recipes as of April 2008 Content: - TAO Multi-Session CD Cookbook (CD-R, CD-RW) - SAO CD Cookbook (CD-R, CD-RW, pure audio or pure data only) -- Overwriteable DVD Cookbook (DVD-RAM, DVD+RW, DVD-RW) +- Overwriteable DVD Cookbook (DVD-RAM, DVD+RW, DVD-RW, BD-RE) - Sequential DVD-R[W] Cookbook - DVD+R[/DL] Cookbook @@ -403,8 +403,8 @@ correctness of Pre-gap and Post-gap would become evident. ------------------------------------------------------------------------------- Inspired by Andy Polyakov's http://fy.chalmers.se/~appro/linux/DVD+RW/tools , backed by reading mmc5r03c.pdf from http://www.t10.org/ftp/t10/drafts/mmc5/ -and by experiments with drives NEC ND-4570A, LG GSA-4082B, PHILIPS SPD3300L. -BD-RE experiments done by Giulio Orsero on LG BE06LU10. +by own experiments with drives NEC ND-4570A, LG GSA-4082B, PHILIPS SPD3300L, +and by BD-RE experiments done by Giulio Orsero on LG BE06LU10. For libburnia-project.org by Thomas Schmitt @@ -417,7 +417,7 @@ DVD-RAM 0012h DVD-RW Restricted Overwrite 0013h DVD-RW Sequential Recording 0014h (i.e. unformatted) DVD+RW 001Ah -BD-RE 0043h (writing tested, formatting not tested) +BD-RE 0043h A short compilation of the write model: - Overwriting in general diff --git a/libburn/drive.c b/libburn/drive.c index d37ef85..c29d247 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -2170,10 +2170,11 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt, if (wt == BURN_WRITE_NONE || wt == BURN_WRITE_SAO || wt == BURN_WRITE_TAO) o->might_simulate = 1; - } else if (d->current_profile == 0x12 || d->current_profile == 0x13 || + } else if (d->current_profile == 0x12 || + d->current_profile == 0x13 || d->current_profile == 0x1a || - (d->current_profile == 0x43 && - burn_support_untested_profiles)) { + d->current_profile == 0x43 + ) { /* DVD-RAM, overwriteable DVD-RW, DVD+RW, BD-RE */ o->start_adr = 1; ret = burn_disc_get_formats(d, &status, &size, &dummy, diff --git a/libburn/libburn.h b/libburn/libburn.h index 1341d7e..e464c35 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -730,7 +730,6 @@ void burn_preset_device_open(int exclusive, int blocking, int abort_on_busy); /** Allows the use of media types which are implemented in libburn but not yet tested. The list of those untested profiles is subject to change. Currently it contains: 0x15 "DVD-R/DL sequential recording", - 0x43 "BD-RE" If you really test such media, then please report the outcome on libburn-hackers@pykix.org If ever then this call should be done soon after burn_initialize() before @@ -1094,9 +1093,9 @@ off_t burn_disc_available_space(struct burn_drive *d, 0x11 "DVD-R sequential recording", 0x12 "DVD-RAM", 0x13 "DVD-RW restricted overwrite", 0x14 "DVD-RW sequential recording", 0x1a "DVD+RW", 0x1b "DVD+R" - 0x2b "DVD+R/DL" + 0x2b "DVD+R/DL", 0x43 "BD-RE" If enabled by burn_allow_untested_profiles() it also writes to profiles - 0x15 "DVD-R/DL sequential recording", 0x43 "BD-RE". + 0x15 "DVD-R/DL sequential recording", Writeable stdio-drives return this profile: 0xffff "stdio file" @param d The drive where the media is inserted. diff --git a/libburn/mmc.c b/libburn/mmc.c index e7cc328..f5edd8a 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -2126,8 +2126,7 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len) d->current_is_supported_profile = 1; #endif #ifdef Libburn_support_dvd_raM - if (cp == 0x12 || (cp == 0x43 && burn_support_untested_profiles)) { - /* DVD-RAM , BD-RE */ + if (cp == 0x12 || cp == 0x43) { /* DVD-RAM , BD-RE */ d->current_is_supported_profile = 1; #ifdef Libburn_dvd_ram_as_bd_rE @@ -2910,8 +2909,7 @@ no_suitable_formatting_type:; c.opcode[1] |= 0x08; } - } else if (d->current_profile == 0x43 && - burn_support_untested_profiles) { + } else if (d->current_profile == 0x43) { /* BD-RE */ index = -1; format_size = -1; diff --git a/test/libburner.c b/test/libburner.c index f39c968..b5c261b 100644 --- a/test/libburner.c +++ b/test/libburner.c @@ -8,8 +8,9 @@ libburner is a minimal demo application for the library libburn as provided on http://libburnia-project.org . It can list the available devices, can - blank a CD-RW or DVD-RW, can format a DVD-RW, can burn to CD-R, CD-RW, DVD-R, - DVD+R, DVD+R/DL, DVD+RW, DVD-RAM or DVD-RW. Not supported yet: DVD-R/DL, BD. + blank a CD-RW or DVD-RW, can format DVD-RW and BD-RE, can burn to CD-R, + CD-RW, DVD-R, DVD+R, DVD+R/DL, DVD+RW, DVD-RW, DVD-RAM, BD-RE. + Not supported yet: DVD-R/DL, BD-R. It's main purpose, nevertheless, is to show you how to use libburn and also to serve the libburnia team as reference application. libburner.c does indeed @@ -28,7 +29,8 @@ With that aquired drive you can blank a CD-RW libburner_blank_disc() or you can format a DVD-RW to profile "Restricted Overwrite" (needed once) - libburner_format_row() + or an unused BD-RE to default size + libburner_format_owrt() With the aquired drive you can burn to CD or DVD libburner_payload() When everything is done, main() releases the drive and shuts down libburn: @@ -313,26 +315,45 @@ int libburner_blank_disc(struct burn_drive *drive, int blank_fast) } -/** Persistently changes DVD-RW profile 0014h "Sequential Recording" to - profile 0013h "Restricted Overwrite" which needs no blanking for re-use - but is not capable of multi-session. - +/** Formats unformatted DVD-RW to profile 0013h "Restricted Overwrite" + which needs no blanking for re-use but is not capable of multi-session. Expect a behavior similar to blanking with unusual noises from the drive. + + Formats unformatted BD-RE to default size. This will allocate some + reserve space, test for bad blocks and make the media ready for writing. + Expect a very long run time. */ -int libburner_format_row(struct burn_drive *drive) +int libburner_format_owrt(struct burn_drive *drive) { struct burn_progress p; double percent = 1.0; + int ret, status, num_formats, format_flag= 0; + off_t size = 0; + unsigned dummy; if (current_profile == 0x13) { fprintf(stderr, "IDLE: DVD-RW media is already formatted\n"); return 2; - } else if (current_profile != 0x14) { - fprintf(stderr, "FATAL: Can only format DVD-RW\n"); + } else if (current_profile == 0x43) { + ret = burn_disc_get_formats(drive, &status, &size, &dummy, + &num_formats); + if (ret > 0 && status == BURN_FORMAT_IS_FORMATTED) { + fprintf(stderr, + "IDLE: BD-RE media is already formatted\n"); + return 2; + } + size = 0; /* does not really matter */ + format_flag = 3<<1; /* format to default size, no quick */ + } else if (current_profile == 0x14) { /* sequential DVD-RW */ + size = 128 * 1024 * 1024; + format_flag = 1; /* write initial 128 MiB */ + } else { + fprintf(stderr, "FATAL: Can only format DVD-RW or BD-RE\n"); return 0; } + printf("Beginning to format media.\n"); - burn_disc_format(drive, (off_t) 0, 0); + burn_disc_format(drive, size, format_flag); sleep(1); while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { @@ -344,9 +365,10 @@ int libburner_format_row(struct burn_drive *drive) } burn_disc_get_profile(drive_list[0].drive, ¤t_profile, current_profile_name); - printf("Media type now: %4.4xh \"%s\"\n", - current_profile, current_profile_name); - if (current_profile != 0x13) { + if (current_profile == 0x14 || current_profile == 0x13) + printf("Media type now: %4.4xh \"%s\"\n", + current_profile, current_profile_name); + if (current_profile == 0x14) { fprintf(stderr, "FATAL: Failed to change media profile to desired value\n"); return 0; @@ -534,7 +556,8 @@ int libburner_payload(struct burn_drive *drive, burn_session_free(session); burn_disc_free(target_disc); if (multi && current_profile != 0x1a && current_profile != 0x13 && - current_profile != 0x12) /* not with DVD+RW, DVD-RW, DVD-RAM */ + current_profile != 0x12 && current_profile != 0x43) + /* not with DVD+RW, formatted DVD-RW, DVD-RAM, BD-RE */ printf("NOTE: Media left appendable.\n"); if (simulate_burn) printf("\n*** Did TRY to SIMULATE burning ***\n\n"); @@ -697,7 +720,7 @@ int main(int argc, char **argv) { ret = 0; goto release_drive; } if (do_blank) { if (do_blank > 100) - ret = libburner_format_row(drive_list[driveno].drive); + ret = libburner_format_owrt(drive_list[driveno].drive); else ret = libburner_blank_disc(drive_list[driveno].drive, do_blank == 1);