Removed unnecessary waiting loops after grab, mentioned DVD+RW

This commit is contained in:
Thomas Schmitt 2006-12-24 20:24:43 +00:00
parent 42c0cc6dd4
commit 00afac796e
2 changed files with 10 additions and 31 deletions

View File

@ -8,7 +8,7 @@
libburner is a minimal demo application for the library libburn as provided libburner is a minimal demo application for the library libburn as provided
on http://libburnia.pykix.org . It can list the available devices, can on http://libburnia.pykix.org . It can list the available devices, can
blank a CD-RW and can burn to CD-R or CD-RW. blank a CD-RW and can burn to CD-R, CD-RW or DVD+RW.
It's main purpose, nevertheless, is to show you how to use libburn and also 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 to serve the libburnia team as reference application. libburner.c does indeed
define the standard way how above three gestures can be implemented and define the standard way how above three gestures can be implemented and
@ -25,7 +25,7 @@
libburner_aquire_by_driveno() demonstrates a scan-and-choose approach libburner_aquire_by_driveno() demonstrates a scan-and-choose approach
With that aquired drive you can blank a CD-RW With that aquired drive you can blank a CD-RW
libburner_blank_disc() libburner_blank_disc()
With the aquired drive you can burn to CD-R or blank CD-RW With the aquired drive you can burn to CD-R, blank CD-RW or DVD+RW
libburner_payload() libburner_payload()
When everything is done, main() releases the drive and shuts down libburn: When everything is done, main() releases the drive and shuts down libburn:
burn_drive_release(); burn_drive_release();
@ -258,17 +258,13 @@ int libburner_blank_disc(struct burn_drive *drive, int blank_fast)
struct burn_progress p; struct burn_progress p;
int percent = 1; int percent = 1;
while (burn_drive_get_status(drive, NULL) != BURN_DRIVE_IDLE) disc_state = burn_disc_get_status(drive);
usleep(1001);
while ((disc_state = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
usleep(1001);
printf( printf(
"Drive media status: %d (see libburn/libburn.h BURN_DISC_*)\n", "Drive media status: %d (see libburn/libburn.h BURN_DISC_*)\n",
disc_state); disc_state);
if (disc_state == BURN_DISC_BLANK) { if (disc_state == BURN_DISC_BLANK) {
fprintf(stderr, fprintf(stderr,
"IDLE: Blank CD media detected. Will leave it untouched\n"); "IDLE: Blank media detected. Will leave it untouched\n");
return 2; return 2;
} else if (disc_state == BURN_DISC_FULL || } else if (disc_state == BURN_DISC_FULL ||
disc_state == BURN_DISC_APPENDABLE) { disc_state == BURN_DISC_APPENDABLE) {
@ -287,7 +283,7 @@ int libburner_blank_disc(struct burn_drive *drive, int blank_fast)
return 0; return 0;
} }
printf( printf(
"Beginning to %s-blank CD media.\n", (blank_fast?"fast":"full")); "Beginning to %s-blank media.\n", (blank_fast?"fast":"full"));
burn_disc_erase(drive, blank_fast); burn_disc_erase(drive, blank_fast);
sleep(1); sleep(1);
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) {
@ -375,12 +371,8 @@ int libburner_payload(struct burn_drive *drive,
burn_source_free(data_src); burn_source_free(data_src);
} /* trackno loop end */ } /* trackno loop end */
while (burn_drive_get_status(drive, NULL) != BURN_DRIVE_IDLE)
usleep(100001);
/* Evaluate drive and media */ /* Evaluate drive and media */
while ((disc_state = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) disc_state = burn_disc_get_status(drive);
usleep(100001);
if (disc_state == BURN_DISC_APPENDABLE) { if (disc_state == BURN_DISC_APPENDABLE) {
write_mode_tao = 1; write_mode_tao = 1;
} else if (disc_state != BURN_DISC_BLANK) { } else if (disc_state != BURN_DISC_BLANK) {
@ -554,8 +546,8 @@ int libburner_setup(int argc, char **argv)
printf("Burn a compressed afio archive on-the-fly:\n"); printf("Burn a compressed afio archive on-the-fly:\n");
printf(" ( cd my_directory ; find . -print | afio -oZ - ) | \\\n"); printf(" ( cd my_directory ; find . -print | afio -oZ - ) | \\\n");
printf(" %s --drive /dev/hdc -\n", argv[0]); printf(" %s --drive /dev/hdc -\n", argv[0]);
printf("To be read from *not mounted* CD via: afio -tvZ /dev/hdc\n"); printf("To be read from *not mounted* media via: afio -tvZ /dev/hdc\n");
printf("Program tar would need a clean EOF which our padded CD cannot deliver.\n"); printf("Program tar would need a clean EOF which our media cannot deliver.\n");
if (insuffient_parameters) if (insuffient_parameters)
return 6; return 6;
} }

View File

@ -229,11 +229,6 @@ int telltoc_media(struct burn_drive *drive)
enum burn_disc_status s; enum burn_disc_status s;
char profile_name[80]; char profile_name[80];
while (burn_drive_get_status(drive, NULL) != BURN_DRIVE_IDLE)
usleep(100001);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
usleep(100001);
printf("Media current: "); printf("Media current: ");
ret = burn_disc_get_profile(drive, &profile_no, profile_name); ret = burn_disc_get_profile(drive, &profile_no, profile_name);
if (profile_no > 0 && ret >0) { if (profile_no > 0 && ret >0) {
@ -247,6 +242,7 @@ int telltoc_media(struct burn_drive *drive)
/* >>> libburn does not obtain full profile list yet */ /* >>> libburn does not obtain full profile list yet */
printf("Media status : "); printf("Media status : ");
s = burn_disc_get_status(drive);
if (s==BURN_DISC_FULL) { if (s==BURN_DISC_FULL) {
printf("is written , is closed\n"); printf("is written , is closed\n");
media_found = 1; media_found = 1;
@ -294,17 +290,11 @@ int telltoc_toc(struct burn_drive *drive)
int num_sessions = 0 , num_tracks = 0 , lba = 0; int num_sessions = 0 , num_tracks = 0 , lba = 0;
int track_count = 0; int track_count = 0;
int session_no, track_no; int session_no, track_no;
enum burn_disc_status s;
struct burn_disc *disc= NULL; struct burn_disc *disc= NULL;
struct burn_session **sessions; struct burn_session **sessions;
struct burn_track **tracks; struct burn_track **tracks;
struct burn_toc_entry toc_entry; struct burn_toc_entry toc_entry;
while (burn_drive_get_status(drive, NULL) != BURN_DRIVE_IDLE)
usleep(100001);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
usleep(100001);
disc = burn_drive_get_disc(drive); disc = burn_drive_get_disc(drive);
if (disc==NULL) { if (disc==NULL) {
fprintf(stderr, "SORRY: Cannot obtain Table Of Content\n"); fprintf(stderr, "SORRY: Cannot obtain Table Of Content\n");
@ -359,10 +349,7 @@ int telltoc_msinfo(struct burn_drive *drive,
struct burn_toc_entry toc_entry; struct burn_toc_entry toc_entry;
struct burn_write_opts *o= NULL; struct burn_write_opts *o= NULL;
while (burn_drive_get_status(drive, NULL) != BURN_DRIVE_IDLE) s = burn_disc_get_status(drive);
usleep(100001);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
usleep(100001);
if (s!=BURN_DISC_APPENDABLE) { if (s!=BURN_DISC_APPENDABLE) {
if (!msinfo_explicit) if (!msinfo_explicit)
return 2; return 2;