From 8610c9bd1d2d6b5c6f975e406f2cf0c764536ae3 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 20 Oct 2006 11:34:52 +0000 Subject: [PATCH] Made cdrskin produce "ATIP start of lead" (on non-blank media for now) --- cdrskin/cdrskin.c | 14 ++++++++++++++ cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 15 +++++++++++++++ libburn/libburn.h | 15 +++++++++++++++ libburn/mmc.c | 19 +++++++++++++++++++ libburn/sg-freebsd.c | 3 +++ libburn/sg-linux.c | 4 ++++ 7 files changed, 71 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 1e83d6f..6222e3c 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -170,6 +170,7 @@ or #define Cdrskin_libburn_has_burn_msgS 1 #define Cdrskin_libburn_has_burn_aborT 1 #define Cdrskin_libburn_has_audioxtR 1 +#define Cdrskin_libburn_has_get_start_end_lbA 1 #endif #ifndef Cdrskin_libburn_versioN @@ -3405,6 +3406,19 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) } else { printf(" Is not erasable\n"); } + +#ifdef Cdrskin_libburn_has_get_start_end_lbA + { int start_lba,end_lba,min,sec,fr; + ret= burn_drive_get_start_end_lba(drive,&start_lba,&end_lba,0); + if(ret>0) { + burn_lba_to_msf(start_lba,&min,&sec,&fr); + printf(" ATIP start of lead in: %d (%d:%d/%d)\n",start_lba,min,sec,fr); + burn_lba_to_msf(end_lba,&min,&sec,&fr); + printf(" ATIP start of lead out: %d (%d:%d/%d)\n",end_lba,min,sec,fr); + } + } +#endif /* Cdrskin_libburn_has_get_start_end_lbA */ + printf(" 1T speed low: %.f 1T speed high: %.f\n",x_speed,x_speed); ret= 1; ex:; diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 7a24616..2f7462b 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2006.10.19.164742" +#define Cdrskin_timestamP "2006.10.20.113421" diff --git a/libburn/drive.c b/libburn/drive.c index 8fc5369..544b2dd 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -297,6 +297,10 @@ void burn_drive_release(struct burn_drive *d, int le) return; } + /* ts A61020 : mark media info as invalid */ + d->start_lba= -2000000000; + d->end_lba= -2000000000; + d->unlock(d); if (le) d->eject(d); @@ -1103,3 +1107,14 @@ int burn_abort(int patience, return(still_not_done == 0); } + +/* ts A61020 API function */ +int burn_drive_get_start_end_lba(struct burn_drive *d, + int *start_lba, int *end_lba, int flag) +{ + if (d->start_lba == -2000000000 || d->end_lba == -2000000000) + return 0; + *start_lba = d->start_lba; + *end_lba= d->end_lba; + return 1; +} diff --git a/libburn/libburn.h b/libburn/libburn.h index a2745df..2a5e3a9 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -627,6 +627,21 @@ void burn_drive_release(struct burn_drive *drive, int eject); */ enum burn_disc_status burn_disc_get_status(struct burn_drive *drive); + +/* ts A61020 */ +/** Returns start and end lba of the media which is currently inserted + in the given drive. The drive has to be grabbed to have hope for reply. + Shortcomming (not a feature): only blank media will return valid info. + @param drive The drive to query. + @param start_lba Returns the start lba value + @param end_lba Returns the end lba value + @param flag Bitfield for control purposes (unused yet, submit 0) + @return 1 if lba values are valid , 0 if invalid +*/ +int burn_drive_get_start_end_lba(struct burn_drive *d, + int *start_lba, int *end_lba, int flag); + + /** Tells whether a disc can be erased or not @return Non-zero means erasable */ diff --git a/libburn/mmc.c b/libburn/mmc.c index b4a6ade..a229699 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -318,6 +318,10 @@ void mmc_read_toc(struct burn_drive *d) burn_print(12, " - control %d, adr %d\n", tdata[1] & 0xF, tdata[1] >> 4); +/* + fprintf(stderr, "libburn_experimental: toc entry #%d : %d %d %d\n",i,tdata[8], tdata[9], tdata[10]); +*/ + if (tdata[3] == 1) { if (burn_msf_to_lba(tdata[8], tdata[9], tdata[10])) { d->disc->session[0]->hidefirst = 1; @@ -384,11 +388,26 @@ void mmc_read_disc_info(struct burn_drive *d) data = c.page->data; d->erasable = !!(data[2] & 16); + + /* ts A61020 */ + d->start_lba = d->end_lba = -2000000000; + +/* + fprintf(stderr, "libburn_experimental: data[2]= %d 0x%x\n", + (unsigned) data[2], (unsigned) data[2]); +*/ switch (data[2] & 3) { case 0: d->toc_entries = 0; d->start_lba = burn_msf_to_lba(data[17], data[18], data[19]); d->end_lba = burn_msf_to_lba(data[21], data[22], data[23]); + +/* + fprintf(stderr, "libburn_experimental: start_lba = %d (%d %d %d) , end_lba = %d (%d %d %d)\n", + d->start_lba, data[17], data[18], data[19], + d->end_lba, data[21], data[22], data[23]); +*/ + d->status = BURN_DISC_BLANK; break; case 1: diff --git a/libburn/sg-freebsd.c b/libburn/sg-freebsd.c index 939ac35..8a9422a 100644 --- a/libburn/sg-freebsd.c +++ b/libburn/sg-freebsd.c @@ -206,6 +206,9 @@ static void enumerate_common(char *fname, int bus_no, int host_no, out.devname = burn_strdup(fname); out.cam = NULL; + out.start_lba= -2000000000; + out.end_lba= -2000000000; + out.grab = sg_grab; out.release = sg_release; out.issue_command = sg_issue_command; diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index 8ff18d7..9b6eaef 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -440,6 +440,10 @@ static void enumerate_common(char *fname, int bus_no, int host_no, for(i= 0; i