From c7c449941187e1ac083ea8b83f1edacba984e329 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Oct 2007 18:30:37 +0000 Subject: [PATCH] Implemented core of option -toc --- test/xorriso.c | 6 +- test/xorriso_private.h | 5 ++ test/xorriso_timestamp.h | 2 +- test/xorrisoburn.c | 123 ++++++++++++++++++++++++++++++++++++++- test/xorrisoburn.h | 3 + 5 files changed, 135 insertions(+), 4 deletions(-) diff --git a/test/xorriso.c b/test/xorriso.c index 6b0880c7..a4387575 100644 --- a/test/xorriso.c +++ b/test/xorriso.c @@ -4305,8 +4305,10 @@ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag) /* Option -toc */ int Xorriso_option_toc(struct XorrisO *xorriso, int flag) { - fprintf(stderr, ">>> LIBISOBURN : -toc\n"); - return(1); + int ret; + + ret= Xorriso_toc(xorriso, 0); + return(ret); } diff --git a/test/xorriso_private.h b/test/xorriso_private.h index 1b1bdabb..8694c68b 100644 --- a/test/xorriso_private.h +++ b/test/xorriso_private.h @@ -167,8 +167,13 @@ struct XorrisO { /* the global context of xorriso */ int Xorriso_destroy(struct XorrisO **xorriso, int flag); + int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag); + +int Xorriso_result(struct XorrisO *xorriso, int flag); + int Xorriso_info(struct XorrisO *xorriso, int flag); + int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv, int flag); diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index cb307a37..72a8ef2f 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.17.165352" +#define Xorriso_timestamP "2007.10.17.183024" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index 335865e1..806a2812 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -302,7 +302,6 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, struct burn_progress progress; char *status_text; - while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) usleep(100002); @@ -500,3 +499,125 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) return(1); } + +int Xorriso_toc(struct XorrisO *xorriso, int flag) +{ + int num_sessions= 0 , num_tracks= 0 , lba= 0, nwa, pmin, psec, pframe, ret; + int track_count= 0, session_no, track_no, profile_no= -1; + int last_track_start= 0, last_track_size= -1; + char profile_name[80],*respt; + struct burn_disc *disc= NULL; + struct burn_session **sessions; + struct burn_track **tracks; + struct burn_toc_entry toc_entry; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + enum burn_disc_status s; + + dinfo= (struct burn_drive_info *) xorriso->in_drive_handle; + if(dinfo==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "No drive aquired on attempt to print Table Of Content"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + drive= dinfo[0].drive; + + respt= xorriso->result_line; + + sprintf(respt, "Media current: "); + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + if (profile_no > 0 && ret > 0) { + if (profile_name[0]) + sprintf(respt+strlen(respt), "%s\n", profile_name); + else + sprintf(respt+strlen(respt), "%4.4Xh\n", profile_no); + } else + sprintf(respt+strlen(respt), "is not recognizable\n"); + Xorriso_result(xorriso,0); + + sprintf(respt, "Media status : "); + s= isoburn_disc_get_status(drive); + if (s == BURN_DISC_FULL) { + sprintf(respt+strlen(respt), "is written , is closed\n"); + } else if (s == BURN_DISC_APPENDABLE) { + sprintf(respt+strlen(respt), "is written , is appendable\n"); + } else if (s == BURN_DISC_BLANK) { + sprintf(respt+strlen(respt), "is blank\n"); + } else if (s == BURN_DISC_EMPTY) + sprintf(respt+strlen(respt), "is not present\n"); + else + sprintf(respt+strlen(respt), "is not recognizable\n"); + Xorriso_result(xorriso,0); + + if(s != BURN_DISC_FULL && s!= BURN_DISC_APPENDABLE) + return(1); + + disc= burn_drive_get_disc(drive); + if (disc==NULL) { + Xorriso_process_msg_queues(xorriso,0); + ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); + if(ret<=0) { + sprintf(xorriso->info_text, "Cannot obtain Table Of Content"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + /* fabricate TOC */ + sprintf(respt, "Media content: session %2d ", 1); + sprintf(respt+strlen(respt), "track %2d %s lba: %9d\n", 1, "data ", 0); + Xorriso_result(xorriso,0); + last_track_start= lba; + sprintf(respt, "Media content: session %2d ", 1); + sprintf(respt+strlen(respt), "leadout lba: %9d\n", nwa); + Xorriso_result(xorriso,0); + last_track_size= nwa; + } else { + sessions= burn_disc_get_sessions(disc, &num_sessions); + for (session_no= 0; session_no>> tell nwa */; + + } + + if (disc!=NULL) + burn_disc_free(disc); + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + diff --git a/test/xorrisoburn.h b/test/xorrisoburn.h index 8c98b347..2c7ea7b9 100644 --- a/test/xorrisoburn.h +++ b/test/xorrisoburn.h @@ -33,5 +33,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag); +int Xorriso_toc(struct XorrisO *xorriso, int flag); + + #endif /* Xorrisoburn_includeD */