Ticket #1299: mtd_verbose_wipe_ioctl.patch
File mtd_verbose_wipe_ioctl.patch, 14.4 KB (added by , 18 years ago) |
---|
-
mythdvd/mtd/jobthread.cpp
46 46 47 47 void JobThread::run() 48 48 { 49 cerr << "jobthread.o: Somebody ran an actual (base class) JobThread. I don't think that's supposed to happen." << endl; 49 VERBOSE(VB_IMPORTANT, "Somebody ran an actual (base class) JobThread. I" 50 " don't think that's supposed to happen."); 50 51 } 51 52 52 53 bool JobThread::keepGoing() … … 217 218 { 218 219 if (!(m_mutex && m_mutex->locked())) 219 220 { 220 cerr << __FILE__ << ": Invalid mutext passed to MutexUnlocker" 221 << endl; 221 VERBOSE(VB_IMPORTANT, 222 QString("%1: Invalid mutext passed to MutexUnlocker") 223 .arg(__FILE__)); 222 224 } 223 225 } 224 226 … … 284 286 285 287 void DVDThread::run() 286 288 { 287 cerr << "jobthread.o: Somebody ran an actual (base class) DVDThread. I don't think that's supposed to happen." << endl; 289 VERBOSE(VB_IMPORTANT, "Somebody ran an actual (base class) DVDThread. I" 290 " don't think that's supposed to happen."); 288 291 } 289 292 290 293 … … 476 479 &video_data[0]); 477 480 if( len != 1) 478 481 { 479 problem(QString("DVDPerfectThread read failed for block %1").arg(cur_pack)); 482 problem(QString("DVDPerfectThread read failed for block %1") 483 .arg(cur_pack)); 480 484 return false; 481 485 } 482 486 -
mythdvd/mtd/dvdprobe.cpp
289 289 else 290 290 { 291 291 fr_code = 0; 292 cerr << "dvdprobe.o: Could not find a frame rate code given a frame rate of " << fr << endl ; 292 VERBOSE(VB_IMPORTANT, 293 QString("dvdprobe.o: Could not find a frame rate code given a" 294 " frame rate of %1").arg(fr)); 293 295 } 294 296 295 297 … … 401 403 } 402 404 else 403 405 { 404 cerr << "dvdprobe.o: You have a title on your dvd in a format myth doesn't understand." << endl; 405 cerr << "dvdprobe.o: Either that, or you haven't installed the dvdinput table." << endl; 406 cerr << "dvdprobe.o: You probably want to report this to a mailing list or something: " << endl; 407 cerr << " height = " << hsize << endl; 408 cerr << " width = " << vsize << endl; 409 cerr << " aspect ratio = " << aspect_ratio << " (" << ar_numerator << "/"<< ar_denominator << ")" << endl; 410 cerr << " frame rate = " << frame_rate << endl; 411 cerr << " fr_code = " << fr_code << endl; 412 if(letterbox) 413 { 414 cerr << " letterboxed = true " << endl; 415 } 416 else 417 { 418 cerr << " letterboxed = false " << endl; 419 } 420 cerr << " format = " << video_format << endl; 406 QString msg = 407 QString("You have a title on your dvd in a format myth doesn't" 408 " understand.\n" 409 "Either that, or you haven't installed the dvdinput" 410 " table.\n" 411 "You probably want to report this to a mailing list or" 412 " something:\n" 413 " height = %1\n" 414 " width = %2\n" 415 " aspect ratio = %3 (%4/%5)\n" 416 " frame rate = %6\n" 417 " fr_code = %7\n" 418 " letterboxed = %8\n" 419 " format = %9") 420 .arg(hsize).arg(vsize) 421 .arg(aspect_ratio).arg(ar_numerator).arg(ar_denominator) 422 .arg(frame_rate).arg(fr_code).arg(letterbox).arg(video_format); 423 VERBOSE(VB_IMPORTANT, msg); 421 424 } 422 425 } 423 426 … … 442 445 device = dvd_device; 443 446 dvd = NULL; 444 447 titles.setAutoDelete(true); 445 titles.clear(); 446 volume_name = QObject::tr("Unknown"); 447 first_time = true; 448 wipeClean(); 448 449 } 449 450 450 451 void DVDProbe::wipeClean() 451 452 { 453 first_time = true; 452 454 titles.clear(); 453 455 volume_name = QObject::tr("Unknown"); 454 456 } … … 481 483 // 482 484 483 485 int drive_handle = open(device, O_RDONLY | O_NONBLOCK); 484 int status = ioctl(drive_handle, CDROM_DRIVE_STATUS, NULL); 486 487 if (drive_handle == -1) 488 { 489 wipeClean(); 490 return false; 491 } 492 493 // Sometimes the first result following an open is a lie. Often the 494 // first call will return 4, however an immediate second call will 495 // return 2. Anecdotally the first result after an open has only 496 // a 1 in 8 chance of detecting changes from 4 to 2, while a second call 497 // (in an admittedly small test number) seems to make it much more 498 // accurate (with only a 1 in 6 chance that the first result was more 499 // accurate than the second). 500 ioctl(drive_handle, CDROM_DRIVE_STATUS, CDSL_CURRENT); 501 int status = ioctl(drive_handle, CDROM_DRIVE_STATUS, CDSL_CURRENT); 485 502 if(status < 4) 486 503 { 487 504 // … … 529 546 // could be a path, file, whatever). 530 547 // 531 548 549 wipeClean(); 532 550 first_time = false; 533 wipeClean();534 551 dvd = DVDOpen(device); 535 552 if(dvd) 536 553 { … … 548 565 } 549 566 else 550 567 { 551 cerr << "dvdprobe.o: Error getting volume name, setting to \"Unknown\"" << endl; 568 VERBOSE(VB_IMPORTANT, "Error getting volume name, setting to" 569 "\"Unknown\""); 552 570 } 553 571 554 572 ifo_handle_t *ifo_file = ifoOpen(dvd, 0); … … 574 592 video_transport_file = ifoOpen(dvd, title_info->title[i].title_set_nr); 575 593 if(!video_transport_file) 576 594 { 577 cerr << "dvdprobe.o: Can't get video transport for track " << i+1 << endl; 595 VERBOSE(VB_IMPORTANT, 596 QString("Can't get video transport for track %1") 597 .arg(i+1)); 578 598 } 579 599 else 580 600 { … … 603 623 framerate = 24000/1001.0; // NTSC_FILM 604 624 break; 605 625 default: 606 cerr << "dvdprobe.o: For some odd reason (!), I couldn't get a video frame rate" << endl; 626 VERBOSE(VB_IMPORTANT, 627 "For some odd reason (!), I couldn't get a" 628 " video frame rate"); 607 629 break; 608 630 } 609 631 … … 688 710 new_title->setAR(16, 9, "16:9"); 689 711 break; 690 712 default: 691 cerr << "dvdprobe.o: couldn't get aspect ratio for a title" << endl; 713 VERBOSE(VB_IMPORTANT, "couldn't get aspect" 714 " ratio for a title"); 692 715 } 693 716 694 717 switch(video_attributes->video_format) … … 700 723 new_title->setVFormat("pal"); 701 724 break; 702 725 default: 703 cerr << "dvdprobe.o: Could not get video format for a title" << endl; 726 VERBOSE(VB_IMPORTANT, "Could not get video" 727 " format for a title"); 704 728 } 705 729 706 730 if(video_attributes->letterboxed) … … 728 752 new_title->setSize(352, c_height / 2); 729 753 break; 730 754 default: 731 cerr << "dvdprobe.o: Could not determine for video size for a title." << endl ; 755 VERBOSE(VB_IMPORTANT, "Could not determine for" 756 " video size for a title."); 732 757 } 733 758 ifoClose(video_transport_file); 734 759 } 735 760 else 736 761 { 737 cerr << "Couldn't find any audio or video information for track " << i+1 << endl; 762 VERBOSE(VB_IMPORTANT, 763 QString("Couldn't find any audio or video" 764 " information for track %1").arg(i+1)); 738 765 } 739 766 } 740 767 … … 803 830 } 804 831 wipeClean(); 805 832 } 806 -
mythdvd/mtd/fileobs.cpp
59 59 QDir stupid_qdir("this_is_stupid"); 60 60 if(!stupid_qdir.rename(active_file->name(), new_name)) 61 61 { 62 cerr << "fileobs.o: Couldn't rename a ripped file on close ... that sucks." << endl; 63 cerr << " old name: \"" << active_file->name() << "\"" << endl; 64 cerr << " new name: \"" << new_name << "\"" << endl; 62 VERBOSE(VB_IMPORTANT, 63 QString("Couldn't rename a ripped file on close ... " 64 " that sucks.\n" 65 " old name: \"%1\"\n" 66 " new name: \"%1\"") 67 .arg(active_file->name()).arg(new_name)); 65 68 } 66 69 else 67 70 { … … 74 77 QFile *iter; 75 78 for(iter = files.first(); iter; iter = files.next()) 76 79 { 77 QString new_name = iter->name() + QString("%1").arg(files.count()) + extension; 80 QString new_name = iter->name() + QString("%1").arg(files.count()) + 81 extension; 78 82 if(!stupid_qdir.rename(iter->name(), new_name)) 79 83 { 80 cerr << "fileobs.o: Couldn't rename \"" << iter->name() << "\" to \"" << new_name << "\"" << endl; 84 VERBOSE(VB_IMPORTANT, QString("Couldn't rename '%1' to '%2'") 85 .arg(iter->name()).arg(new_name)); 81 86 } 82 87 else 83 88 { … … 124 129 files.append(new_file); 125 130 if(!active_file->open(access_mode)) 126 131 { 127 cerr << "fileobs.o: couldn't open another file in a set of rip files." << endl; 132 VERBOSE(VB_IMPORTANT, 133 "couldn't open another file in a set of rip files."); 128 134 return false; 129 135 } 130 136 bytes_written = 0; … … 132 138 int result = write(active_file->handle(), the_data, how_much); 133 139 if(result < 0) 134 140 { 135 cerr << "fileobs.o: Got a negative result while writing blocks. World may end shortly." << endl; 141 VERBOSE(VB_IMPORTANT, "Got a negative result while writing blocks." 142 " World may end shortly."); 136 143 return false; 137 144 } 138 145 if(result == 0) 139 146 { 140 147 if(how_much == 0) 141 148 { 142 cerr << "fileobs.o: Ripfile wrote 0 bytes, but that's all it was asked to. Unlikely coincidence?" << endl; 149 VERBOSE(VB_IMPORTANT, "Ripfile wrote 0 bytes, but that's all it" 150 " was asked to. Unlikely coincidence?"); 143 151 } 144 152 else 145 153 { 146 cerr << "fileobs.o: Ripfile writing 0 bytes of data. That's probably not a good sign." << endl; 154 VERBOSE(VB_IMPORTANT, "Ripfile writing 0 bytes of data. That's" 155 " probably not a good sign."); 147 156 return false; 148 157 } 149 158 } 150 159 if(result != how_much) 151 160 { 152 cerr << "fileobs.o: Ripfile tried to write " << how_much << " bytes, but only managed to write " << result << endl ; 161 VERBOSE(VB_IMPORTANT, QString("Ripfile tried to write %1 bytes, but" 162 " only managed to write %2") 163 .arg(how_much).arg(result)); 153 164 return false; 154 165 } 155 166 bytes_written += result; -
mythdvd/mtd/main.cpp
70 70 return FRONTEND_EXIT_INVALID_CMDLINE; 71 71 } 72 72 } 73 else if (!strcmp(a.argv()[argpos],"-v")) 74 { 75 if (++argpos >= argc) { 76 cerr << "Error: -v requires parameters (try -v help)" << 77 std::endl; 78 return GENERIC_EXIT_INVALID_CMDLINE; 79 } 80 81 int err; 82 if ((err = parse_verbose_arg(a.argv()[argpos])) != 83 GENERIC_EXIT_OK) 84 { 85 return err; 86 } 87 } 73 88 else 74 89 { 75 90 cerr << "Invalid argument: " << a.argv()[argpos] << endl << -
mythdvd/mtd/logging.cpp
25 25 QString logfile_name = gContext->GetSetting("DVDRipLocation"); 26 26 if(logfile_name.length() < 1) 27 27 { 28 cerr << "MTDLogger.o: You do not have a DVD rip directory set. Run Setup." << endl; 28 VERBOSE(VB_IMPORTANT, "You do not have a DVD rip directory set." 29 " Run Setup."); 29 30 exit(0); 30 31 } 31 32 logfile_name.append("/mtd.log"); … … 34 35 logging_file.setName(logfile_name); 35 36 if(!logging_file.open(IO_WriteOnly)) 36 37 { 37 cerr << "MTDLogger.o: Problem opening logfile. Does this look openable to you: " << logfile_name << endl; 38 VERBOSE(VB_IMPORTANT, QString("Problem opening logfile. Does this" 39 "look openable to you: %1") 40 .arg(logfile_name)); 38 41 exit(0); 39 42 } 40 43 } -
configure
347 347 fi 348 348 fi 349 349 350 # vcd support detection r utine does here350 # vcd support detection routine does here 351 351 352 352 if test "$exif" != "no" ; then 353 353 exif="no"