Now automatically write out a list of bad sectors
This commit is contained in:
parent
5155fde7de
commit
fcbe593e3c
2 changed files with 29 additions and 1 deletions
|
|
@ -40,7 +40,7 @@
|
|||
int debug = 1;
|
||||
|
||||
|
||||
DVDCopy::DVDCopy()
|
||||
DVDCopy::DVDCopy() : badSectors(NULL)
|
||||
{
|
||||
readBuffer = new char[BUF_SIZE];
|
||||
reader = NULL;
|
||||
|
|
@ -167,6 +167,7 @@ void DVDCopy::copyFile(const DVDFileData * dat)
|
|||
printf("\rError while reading block %d of file %s, skipping\n",
|
||||
blk, fileName.c_str());
|
||||
outfile.skipSectors(nb);
|
||||
registerBadSectors(dat, blk, nb);
|
||||
read = nb;
|
||||
skipped += nb;
|
||||
}
|
||||
|
|
@ -256,4 +257,23 @@ DVDCopy::~DVDCopy()
|
|||
delete readBuffer;
|
||||
if(reader)
|
||||
DVDClose(reader);
|
||||
if(badSectors)
|
||||
fclose(badSectors);
|
||||
}
|
||||
|
||||
|
||||
void DVDCopy::registerBadSectors(const DVDFileData * dat,
|
||||
int beg, int size)
|
||||
{
|
||||
if(! badSectors) {
|
||||
std::string bsf = targetDirectory + ".bad";
|
||||
badSectors = fopen(bsf.c_str(), "a");
|
||||
}
|
||||
|
||||
fprintf(badSectors, "%s: %d,%d,%d %d (%d)\n",
|
||||
dat->fileName().c_str(),
|
||||
dat->title,
|
||||
dat->domain,
|
||||
dat->number,
|
||||
beg, size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ class DVDCopy {
|
|||
/// The target directory.
|
||||
std::string targetDirectory;
|
||||
|
||||
/// A list of bad sectors that were skipped upon reading.
|
||||
/// In the hope to be read again...
|
||||
FILE * badSectors;
|
||||
|
||||
/// Writes a bad sector list to the file
|
||||
void registerBadSectors(const DVDFileData * dat,
|
||||
int beg, int size);
|
||||
|
||||
public:
|
||||
|
||||
DVDCopy();
|
||||
|
|
|
|||
Loading…
Reference in a new issue