From a5e2729604e2b1157278c5362000c2f9c1f7e239 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 9 Dec 2008 12:35:13 +0000 Subject: [PATCH] Beginning to implement write code for BD-R SRM without POW --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/async.c | 5 +++++ libburn/drive.c | 5 +++-- libburn/libburn.h | 7 ++++--- libburn/mmc.c | 29 +++++++++++++++++++++++++---- libburn/write.c | 37 ++++++++++++++++++++++++++++++------- 6 files changed, 68 insertions(+), 17 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index e1a8334..99a6056 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.12.07.155219" +#define Cdrskin_timestamP "2008.12.09.123314" diff --git a/libburn/async.c b/libburn/async.c index 2367fea..456f21c 100644 --- a/libburn/async.c +++ b/libburn/async.c @@ -409,6 +409,11 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag) flag |= 4; /* format up to maximum size */ } else if (drive->current_profile == 0x12) { ok = 1; /* DVD-RAM */ + + } else if (drive->current_profile == 0x41) { + /* >>> BD-R SRM */ + /* >>> check whether still unformatted */; + } else if (drive->current_profile == 0x43) { ok = 1; /* BD-RE */ } diff --git a/libburn/drive.c b/libburn/drive.c index e1a138f..a878054 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -2246,8 +2246,9 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt, o->might_do_sao = 4; o->might_do_tao = 2; o->advised_write_mode = BURN_WRITE_TAO; - } else if (d->current_profile == 0x1b || d->current_profile == 0x2b) { - /* DVD+R , DVD+R/DL */ + } else if (d->current_profile == 0x1b || d->current_profile == 0x2b || + d->current_profile == 0x41) { + /* DVD+R , DVD+R/DL , BD-R SRM */ o->multi_session = o->multi_track = 1; o->might_do_tao = 2; o->might_do_sao = 1; diff --git a/libburn/libburn.h b/libburn/libburn.h index 80867c4..3ad7597 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1137,7 +1137,8 @@ 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", 0x43 "BD-RE", + 0x2b "DVD+R/DL", + 0x41 "BD-R sequential recording", 0x43 "BD-RE", 0xffff "stdio file" Note: 0xffff is not a MMC profile but a libburn invention. If enabled by burn_allow_untested_profiles() it also writes to profiles @@ -1145,8 +1146,8 @@ off_t burn_disc_available_space(struct burn_drive *d, Read-only are the profiles 0x08 "CD-ROM", 0x10 "DVD-ROM", 0x40 "BD-ROM", - For now read-only are BD-R profiles (testers wanted) - 0x41 "BD-R sequential recording", 0x42 "BD-R random recording" + For now read-only is BD-R profile (testers wanted) + 0x42 "BD-R random recording" @param d The drive where the media is inserted. @param pno Profile Number. See also mmc5r03c.pdf, table 89 @param name Profile Name (see above list, unknown profiles have empty name) diff --git a/libburn/mmc.c b/libburn/mmc.c index ea98bad..71a40f2 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -58,6 +58,9 @@ extern struct libdax_msgs *libdax_messenger; /* ts A70509 : handling 0x41 and 0x42 as read-only types */ #define Libburn_support_bd_r_readonlY 1 +/* >>> ts A81208 */ +#define Libburn_support_bd_plus_r_srM 1 + /* ts A80410 : <<< Dangerous experiment: Pretend that DVD-RAM is BD-RE # define Libburn_dvd_ram_as_bd_rE yes @@ -119,6 +122,8 @@ extern struct libdax_msgs *libdax_messenger; drive->do_stream_recording it does full nominal speed. ts A80506 : Giulio Orsero reports success with BD-RE formatting. BD-RE is now an officially supported profile. + ts A81209 : The first two sessions have been written to BD-R SRM + (auto formatted without Defect Management). */ /* ts A70519 : With MMC commands of data direction FROM_DRIVE: @@ -1528,8 +1533,15 @@ static int mmc_read_disc_info_al(struct burn_drive *d, int *alloc_len) #ifdef Libburn_support_bd_r_readonlY /* <<< For now: declaring BD-R read-only */ - if (d->current_profile == 0x41 || d->current_profile == 0x42) { - /* BD-R seq, BD-R rnd */ +#ifndef Libburn_support_bd_plus_r_srM + if (d->current_profile == 0x41) { + /* BD-R seq as readonly dummy */ + disc_status = 2; /* always full and finalized */ + d->erasable = 0; /* never erasable */ + } +#endif + if (d->current_profile == 0x42) { + /* BD-R rnd */ disc_status = 2; /* always full and finalized */ d->erasable = 0; /* never erasable */ } @@ -2239,7 +2251,11 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len) d->current_is_supported_profile = 1; #ifdef Libburn_support_bd_r_readonlY - if (cp == 0x41 || cp == 0x42) /* BD-R sequential, BD-R random */ +#ifndef Libburn_support_bd_plus_r_srM + if (cp == 0x41) /* BD-R sequential (here as read-only dummy) */ + d->current_is_supported_profile = 1; +#endif + if (cp == 0x42) /* BD-R random recording */ d->current_is_supported_profile = 1; #endif @@ -2280,6 +2296,10 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len) if (cp == 0x1b || cp == 0x2b) /* DVD+R , DVD+R/DL */ d->current_is_supported_profile = 1; #endif +#ifdef Libburn_support_bd_plus_r_srM + if (cp == 0x41) /* BD-R SRM */ + d->current_is_supported_profile = 1; +#endif /* Enable this to get loud and repeated reports about the feature set : #define Libburn_print_feature_descriptorS 1 @@ -3440,8 +3460,9 @@ int mmc_compose_mode_page_5(struct burn_drive *d, } else if (d->current_profile == 0x1a || d->current_profile == 0x1b || d->current_profile == 0x2b || d->current_profile == 0x12 || + d->current_profile == 0x41 || d->current_profile == 0x42 || d->current_profile == 0x43) { - /* not with DVD+R[W][/DL] or DVD-RAM or BD-RE */; + /* not with DVD+R[W][/DL] or DVD-RAM or BD-R[E] */; return 0; } else { /* Traditional setup for CD */ diff --git a/libburn/write.c b/libburn/write.c index fb8fa9f..ff3298a 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -1005,8 +1005,10 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc, } else if (d->drive_role == 3 || d->current_profile == 0x11 || d->current_profile == 0x14 || d->current_profile == 0x15 || - d->current_profile == 0x1b || d->current_profile == 0x2b ) { - /* DVD-R* Sequential , DVD+R[/DL] , sequential stdio "drive" */ + d->current_profile == 0x1b || d->current_profile == 0x2b || + d->current_profile == 0x41) { + /* DVD-R* Sequential , DVD+R[/DL] , BD-R, + sequential stdio "drive" */ if (o->start_byte >= 0) strcat(reasons, "write start address not supported, "); } else { @@ -1106,6 +1108,10 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o, if (o->write_type == BURN_WRITE_SAO && ! burn_track_is_open_ended(s->track[tnum])) { /* Round track size up to 32 KiB and reserve track */ + + /* ts A81208 */ + /* >>> ??? round to 64 KiB for BD-R ? (It is not mandatory) */ + size = ((off_t) burn_track_get_sectors(s->track[tnum])) * (off_t) 2048; size = (size + (off_t) 0x7fff) & ~((off_t) 0x7fff); @@ -1200,7 +1206,7 @@ int burn_disc_close_track_dvd_plus_r(struct burn_write_opts *o, } -/* ts A61218 - A70129 */ +/* ts A61218 - A81208 */ int burn_dvd_write_track(struct burn_write_opts *o, struct burn_session *s, int tnum, int is_last_track) { @@ -1224,6 +1230,11 @@ int burn_dvd_write_track(struct burn_write_opts *o, ret = burn_disc_open_track_dvd_plus_r(o, s, tnum); if (ret <= 0) goto ex; + } else if (d->current_profile == 0x41) { + /* BD-R SRM */ + ret = burn_disc_open_track_dvd_plus_r(o, s, tnum); + if (ret <= 0) + goto ex; } sectors = burn_track_get_sectors(t); @@ -1292,6 +1303,12 @@ int burn_dvd_write_track(struct burn_write_opts *o, is_last_track); if (ret <= 0) goto ex; + } else if (d->current_profile == 0x41) { + /* BD-R SRM */ + ret = burn_disc_close_track_dvd_plus_r(o, s, tnum, + is_last_track); + if (ret <= 0) + goto ex; } ret = 1; ex:; @@ -1408,6 +1425,8 @@ int burn_dvd_write_session(struct burn_write_opts *o, } } else if (d->current_profile == 0x1b || d->current_profile == 0x2b) { /* DVD+R , DVD+R/DL do each track as an own session */; + } else if (d->current_profile == 0x41) { + /* BD-R SRM do each track as an own session */; } return 1; } @@ -1611,8 +1630,12 @@ int burn_dvd_write_sync(struct burn_write_opts *o, /* ??? padding needed ??? cowardly doing it for now */ o->obs_pad = 1; /* fill-up track's last 32k buffer */ - } else if (d->current_profile == 0x1b || d->current_profile == 0x2b) { - /* DVD+R , DVD+R/DL */ + } else if (d->current_profile == 0x1b || d->current_profile == 0x2b || + d->current_profile == 0x41) { + /* DVD+R , DVD+R/DL , BD-R SRM */ + + /* >>> ts A81208 : with BD-R set o->obs to 64 kB ? */ + t = disc->session[0]->track[0]; o_end = ( burn_track_is_open_ended(t) && !o->fill_up_media ); default_size = burn_track_get_default_size(t); @@ -1627,8 +1650,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o, } ret = burn_disc_setup_dvd_plus_r(o, disc); if (ret <= 0) { - sprintf(msg, - "Write preparation setup failed for DVD+R"); + sprintf(msg, "Write preparation setup failed for %s", + d->current_profile == 0x41 ? "BD-R" : "DVD+R"); libdax_msgs_submit(libdax_messenger, d->global_index, 0x00020121, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,