From d76fee981639bbc1a6473c05275b4b7120524cd7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 12 Apr 2008 16:42:45 +0000 Subject: [PATCH] New API call burn_write_opts_set_stream_recording() --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/drive.c | 1 + libburn/trunk/libburn/libburn.h | 17 ++++++- libburn/trunk/libburn/mmc.c | 59 +++++++++++++++++------ libburn/trunk/libburn/options.c | 11 +++++ libburn/trunk/libburn/options.h | 5 ++ libburn/trunk/libburn/transport.h | 5 ++ libburn/trunk/libburn/write.c | 12 +++-- 8 files changed, 93 insertions(+), 19 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 83ff10b0..7f521f35 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.04.10.211529" +#define Cdrskin_timestamP "2008.04.12.164244" diff --git a/libburn/trunk/libburn/drive.c b/libburn/trunk/libburn/drive.c index c295d877..9baffe80 100644 --- a/libburn/trunk/libburn/drive.c +++ b/libburn/trunk/libburn/drive.c @@ -61,6 +61,7 @@ int burn_setup_drive(struct burn_drive *d, char *fname) d->released = 1; d->stdio_fd = -1; d->status = BURN_DISC_UNREADY; + d->do_stream_recording = 0; return 1; } diff --git a/libburn/trunk/libburn/libburn.h b/libburn/trunk/libburn/libburn.h index 65eeb785..8547fb28 100644 --- a/libburn/trunk/libburn/libburn.h +++ b/libburn/trunk/libburn/libburn.h @@ -1758,6 +1758,20 @@ void burn_write_opts_set_fillup(struct burn_write_opts *opts, void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force); +/* ts A80412 */ +/** Eventually makes use of the more modern write command AAh WRITE12 and + sets the Streaming bit. With DVD-RAM this can override the traditional + slowdown to half nominal speed. But if it speeds up writing then it also + disables error management and correction. Weigh your priorities. + This only affects the write operations of burn_disc_write(). + @since 0.4.6 + @param opts The write opts to change + @param value 0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit +*/ +void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, + int value); + + /** Sets whether to read in raw mode or not @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 @@ -2189,8 +2203,9 @@ int burn_msgs_submit(int error_code, char msg_text[], int os_errno, int burn_text_to_sev(char *severity_name, int *severity_number, int flag); -/* ts A80202 : @since 0.4.4 */ +/* ts A80202 */ /** Convert a severity number into a severity name + @since 0.4.4 @param severity_number The rank number: the higher, the more severe. @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". @param flag Bitfield for control purposes (unused yet, submit 0) diff --git a/libburn/trunk/libburn/mmc.c b/libburn/trunk/libburn/mmc.c index 2350e252..58778eb3 100644 --- a/libburn/trunk/libburn/mmc.c +++ b/libburn/trunk/libburn/mmc.c @@ -707,22 +707,26 @@ int mmc_write(struct burn_drive *d, int start, struct buffer *buf) if(d->wait_for_buffer_free) mmc_wait_for_buffer_free(d, buf); - scsi_init_command(&c, MMC_WRITE_10, sizeof(MMC_WRITE_10)); -/* - memcpy(c.opcode, MMC_WRITE_10, sizeof(MMC_WRITE_10)); - c.oplen = sizeof(MMC_WRITE_10); -*/ + /* ts A80412 */ + if(d->do_stream_recording > 0) { + + /* >>> ??? is WRITE12 available ? */ + /* >>> ??? inquire feature 107h Stream Writing bit ? */ + + scsi_init_command(&c, MMC_WRITE_12, sizeof(MMC_WRITE_12)); + mmc_int_to_four_char(c.opcode + 2, start); + mmc_int_to_four_char(c.opcode + 6, len); + c.opcode[10] = 1<<7; /* Streaming bit */ + } else { + scsi_init_command(&c, MMC_WRITE_10, sizeof(MMC_WRITE_10)); + mmc_int_to_four_char(c.opcode + 2, start); + c.opcode[6] = 0; + c.opcode[7] = (len >> 8) & 0xFF; + c.opcode[8] = len & 0xFF; + } c.retry = 1; - mmc_int_to_four_char(c.opcode + 2, start); - c.opcode[6] = 0; - c.opcode[7] = (len >> 8) & 0xFF; - c.opcode[8] = len & 0xFF; c.page = buf; c.dir = TO_DRIVE; -/* - burn_print(12, "%d, %d, %d, %d - ", c->opcode[2], c->opcode[3], c->opcode[4], c->opcode[5]); - burn_print(12, "%d, %d, %d, %d\n", c->opcode[6], c->opcode[7], c->opcode[8], c->opcode[9]); -*/ #ifdef Libburn_log_in_and_out_streaM /* <<< ts A61031 */ @@ -2612,7 +2616,9 @@ selected_not_suitable:; } if (!(d->current_profile == 0x13 || d->current_profile == 0x14 || - d->current_profile == 0x1a)) + d->current_profile == 0x1a || + (0 && d->current_profile == 0x12) || + (0 && d->current_profile == 0x43))) /* >>> */ goto unsuitable_media; format_type = d->format_descriptors[index].type; @@ -2741,6 +2747,31 @@ selected_not_suitable:; format_type == 0x15 ? "quick" : "full"); return_immediately = 1; /* caller must do the waiting */ + } else if (0 && d->current_profile == 0x12) { + /* DVD-RAM */ + format_type = 0x00; + if(flag & 4) { + /* >>> search for largest 0x00 format descriptor */; + } else { + /* >>> search for smallest 0x00 descriptor >= size */; + } + /* >>> */; + + } else if (0 && d->current_profile == 0x43 && + burn_support_untested_profiles) { + /* BD-RE */ + format_type = 0x00; + if(flag & 4) { + /* >>> search for format 0x31 */; + /* >>> if 0x31 : */ + /* >>> format_type = 0x31; */ + /* >>> else */ + /* >>> search largest 0x30 format descriptor */; + } else { + /* >>> search for smallest 0x30 descriptor >= size */; + } + /* >>> */; + } else { /* >>> other formattable types to come */ diff --git a/libburn/trunk/libburn/options.c b/libburn/trunk/libburn/options.c index 4dc1ef34..4b8cf458 100644 --- a/libburn/trunk/libburn/options.c +++ b/libburn/trunk/libburn/options.c @@ -38,6 +38,7 @@ struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive) opts->start_byte = -1; opts->fill_up_media = 0; opts->force_is_set = 0; + opts->do_stream_recording = 0; opts->has_mediacatalog = 0; opts->format = BURN_CDROM; opts->multi = 0; @@ -380,6 +381,16 @@ void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force) } +/* ts A80412: API */ +void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, + int value) +{ + opts->do_stream_recording = !!value; +} + + + + /* ts A70901: API */ struct burn_drive *burn_write_opts_get_drive(struct burn_write_opts *opts) { diff --git a/libburn/trunk/libburn/options.h b/libburn/trunk/libburn/options.h index 13d91c31..17c961df 100644 --- a/libburn/trunk/libburn/options.h +++ b/libburn/trunk/libburn/options.h @@ -49,6 +49,11 @@ struct burn_write_opts */ int force_is_set; + /* ts A80412 : whether to use WRITE12 with Streaming bit set + rather than WRITE10. Speeds up DVD-RAM. Might help with BD-RE. + This gets transferred to burn_drive.do_stream_recording */ + int do_stream_recording; + /** A disc can have a media catalog number */ int has_mediacatalog; unsigned char mediacatalog[13]; diff --git a/libburn/trunk/libburn/transport.h b/libburn/trunk/libburn/transport.h index 3b1a33cd..5904c5fd 100644 --- a/libburn/trunk/libburn/transport.h +++ b/libburn/trunk/libburn/transport.h @@ -187,6 +187,11 @@ struct burn_drive synchronize chache has happened yet */ int needs_sync_cache; + /* ts A80412 : whether to use WRITE12 with Streaming bit set + rather than WRITE10. Speeds up DVD-RAM. Might help + with BD-RE */ + int do_stream_recording; + /* ts A61218 from 51h READ DISC INFORMATION */ int bg_format_status; /* 0=needs format start, 1=needs format restart*/ diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index f2f8df91..f03b2f6a 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -1978,6 +1978,9 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc) /* ts A61224 */ burn_disc_init_write_status(o, disc); /* must be done very early */ + /* ts A80412 */ + d->do_stream_recording = o->do_stream_recording; + d->buffer = &buf; memset(d->buffer, 0, sizeof(struct buffer)); d->rlba = -150; @@ -1988,14 +1991,14 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc) ret = burn_stdio_write_sync(o, disc); if (ret <= 0) goto fail_wo_sync; - return; + goto ex; } /* ts A61218 */ if (! d->current_is_cd_profile) { ret = burn_dvd_write_sync(o, disc); if (ret <= 0) goto fail_wo_sync; - return; + goto ex; } /* ts A70218 */ @@ -2148,7 +2151,7 @@ return crap. so we send the command, then ignore the result. /* ts A61012 : This return was traditionally missing. I suspect this to have caused Cdrskin_eject() failures */ - return; + goto ex; fail: d->sync_cache(d); @@ -2160,6 +2163,9 @@ fail_wo_sync:; "Burn run failed", 0, 0); d->cancel = 1; d->busy = BURN_DRIVE_IDLE; +ex:; + d->do_stream_recording = 0; + return; } /* ts A70811 : API function */