mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 10:04:24 +00:00
Further issues when building CUETools on a case sensitive filesystem or
folder were found in CUETools.Codecs.TTA and ttalib-1.1
- Remove precompiled headers from:
CUETools.Codecs.TTA.vcxproj
TTALib.vcxproj
This fixes case sensitivity issues coming from different spellings of
stdafx (stdafx.cpp, Stdafx.cpp; stdafx.h, Stdafx.h). The stdafx.h
header files were empty in both cases, so remove precompiled headers
completely.
Remark: The file TTALib.vcproj was unused and therefore removed.
TTALib.vcxproj is used by CUETools and gets updated.
- Use lowercase ttalib-1.1 for includes in CUETools.Codecs.TTA.cpp,
because the name of the sub-directory, which contains the TTALib
files is lowercase:
TTALib-1.1->ttalib-1.1
- Fix lower/uppercase spelling of included headers in files of
ttalib-1.1 according to the spelling of the filenames:
bitreader.h->BitReader.h
ttareader.h->TTAReader.h
ttawriter.h->TTAWriter.h
Rename the file ttacommon.h for conformity and update the includes:
ttacommon.h->TTACommon.h
- Summary of changes to files (rename, delete):
deleted: CUETools.Codecs.TTA/Stdafx.cpp
deleted: CUETools.Codecs.TTA/Stdafx.h
deleted: ttalib-1.1/Stdafx.cpp
deleted: ttalib-1.1/Stdafx.h
renamed: ttalib-1.1/ttacommon.h -> ttalib-1.1/TTACommon.h
deleted: ttalib-1.1/TTALib.vcproj
69 lines
1.5 KiB
C++
69 lines
1.5 KiB
C++
#pragma once
|
|
#include "BitReader.h"
|
|
|
|
namespace TTALib
|
|
{
|
|
|
|
class TTATester :
|
|
public BitReader
|
|
{
|
|
unsigned char *data;
|
|
unsigned long *seek_table, *fst;
|
|
long fframes;
|
|
public:
|
|
|
|
TTATester(HANDLE hFile)
|
|
: BitReader(hFile), data(NULL), seek_table(NULL), fframes(-1)
|
|
{
|
|
}
|
|
|
|
virtual ~TTATester(void)
|
|
{
|
|
if (seek_table)
|
|
delete [] seek_table;
|
|
if (data)
|
|
delete [] data;
|
|
}
|
|
|
|
virtual void GetHeader (TTAHeader *ttahdr)
|
|
{
|
|
BitReader::GetHeader (ttahdr);
|
|
|
|
long framelen = (long) (FRAME_TIME * ttahdr->SampleRate);
|
|
long framesize = framelen * ttahdr->NumChannels *
|
|
(ttahdr->BitsPerSample + 7) / 8 + 4;
|
|
|
|
long lastlen = ttahdr->DataLength % framelen;
|
|
fframes = ttahdr->DataLength / framelen + (lastlen ? 1 : 0);
|
|
|
|
data = new unsigned char[framesize];
|
|
seek_table = new unsigned long[fframes + 1];
|
|
|
|
if (!GetSeekTable (seek_table, fframes + 1))
|
|
throw TTAException (FILE_ERROR);
|
|
fst = seek_table;
|
|
}
|
|
|
|
|
|
virtual bool TestFrame ()
|
|
{
|
|
unsigned long frame_crc32, result;
|
|
|
|
if (fst >= seek_table + fframes)
|
|
return false;
|
|
|
|
if (!ReadFile(hInFile, data, *fst, &result, NULL) ||
|
|
result != *fst)
|
|
throw TTAException (READ_ERROR);
|
|
else input_byte_count += result;
|
|
|
|
CopyMemory(&frame_crc32, data + (result - 4), 4);
|
|
if (crc32(data, *fst - 4) != ENDSWAP_INT32(frame_crc32))
|
|
throw TTAException (FILE_ERROR);
|
|
|
|
fst ++;
|
|
return true;
|
|
}
|
|
};
|
|
|
|
}; |