Change enum SeekMethod to enum cass type
This commit is contained in:
parent
fb513aaa0c
commit
c2736c5a13
@ -33,7 +33,7 @@ class AbstractOutputStream : public AbstractStream
|
||||
class File : public AbstractOutputStream
|
||||
{
|
||||
public:
|
||||
enum SeekMethod
|
||||
enum class SeekMethod
|
||||
{
|
||||
smBegin,
|
||||
smCurrent,
|
||||
@ -114,7 +114,7 @@ class File : public AbstractOutputStream
|
||||
\param whence
|
||||
\return Location of the cursor after relocating it, or uint64_t(-1) in case of an error.
|
||||
*/
|
||||
uint64_t seek(int64_t offset, SeekMethod whence = smBegin);
|
||||
uint64_t seek(int64_t offset, SeekMethod whence = SeekMethod::smBegin);
|
||||
|
||||
//! Change the size of the file
|
||||
/*!
|
||||
|
@ -190,13 +190,13 @@ uint64_t File::seek(int64_t offset, SeekMethod whence)
|
||||
DWORD moveMethod = 0;
|
||||
switch (whence)
|
||||
{
|
||||
case smBegin:
|
||||
case SeekMethod::smBegin:
|
||||
moveMethod = FILE_BEGIN;
|
||||
break;
|
||||
case smCurrent:
|
||||
case SeekMethod::smCurrent:
|
||||
moveMethod = FILE_CURRENT;
|
||||
break;
|
||||
case smEnd:
|
||||
case SeekMethod::smEnd:
|
||||
moveMethod = FILE_END;
|
||||
break;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ bool BufferedFileReader::gotoByte(uint32_t readerID, uint64_t seekDist)
|
||||
if (data)
|
||||
{
|
||||
data->m_blockSize = m_blockSize - (uint32_t)(seekDist % (uint64_t)m_blockSize);
|
||||
uint64_t seekRez = data->m_file.seek(seekDist + data->m_fileHeaderSize, File::smBegin);
|
||||
uint64_t seekRez = data->m_file.seek(seekDist + data->m_fileHeaderSize, File::SeekMethod::smBegin);
|
||||
bool rez = seekRez != (uint64_t)-1;
|
||||
if (rez)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ struct FileReaderData : public ReaderData
|
||||
|
||||
bool openStream() override;
|
||||
bool closeStream() override { return m_file.close(); }
|
||||
bool incSeek(int64_t offset) override { return m_file.seek(offset, File::smCurrent) != uint64_t(-1); }
|
||||
bool incSeek(int64_t offset) override { return m_file.seek(offset, File::SeekMethod::smCurrent) != uint64_t(-1); }
|
||||
|
||||
public:
|
||||
File m_file;
|
||||
|
@ -933,7 +933,7 @@ uint32_t IsoWriter::absoluteSectorNum() { return m_file.pos() / SECTOR_SIZE - m_
|
||||
void IsoWriter::sectorSeek(Partition partition, int pos)
|
||||
{
|
||||
int64_t offset = (partition == Partition::MetadataPartition) ? m_curMetadataPos : m_partitionStartAddress;
|
||||
m_file.seek((offset + pos) * SECTOR_SIZE, File::smBegin);
|
||||
m_file.seek((offset + pos) * SECTOR_SIZE, File::SeekMethod::smBegin);
|
||||
}
|
||||
|
||||
void IsoWriter::writeEntity(FileEntryInfo* dir)
|
||||
|
@ -726,11 +726,11 @@ bool LPCMStreamReader::beforeFileCloseEvent(File& file)
|
||||
if (fileSize <= 0xfffffffful)
|
||||
{
|
||||
uint32_t dataSize = (uint32_t)fileSize - 8;
|
||||
if (file.seek(4, File::smBegin) == (int64_t)-1)
|
||||
if (file.seek(4, File::SeekMethod::smBegin) == (int64_t)-1)
|
||||
return false;
|
||||
if (file.write(&dataSize, 4) != 4)
|
||||
return false;
|
||||
if (file.seek(64, File::smBegin) == (int64_t)-1)
|
||||
if (file.seek(64, File::SeekMethod::smBegin) == (int64_t)-1)
|
||||
return false;
|
||||
dataSize = (uint32_t)fileSize - 68;
|
||||
if (file.write(&dataSize, 4) != 4)
|
||||
|
@ -401,7 +401,7 @@ int ProgramStreamDemuxer::simpleDemuxBlock(DemuxedData& demuxedData, const PIDSe
|
||||
|
||||
int64_t getLastPCR(File& file, int bufferSize, int64_t fileSize)
|
||||
{
|
||||
file.seek(FFMAX(0, fileSize - bufferSize), File::smBegin);
|
||||
file.seek(FFMAX(0, fileSize - bufferSize), File::SeekMethod::smBegin);
|
||||
uint8_t* tmpBuffer = new uint8_t[bufferSize];
|
||||
int len = file.read(tmpBuffer, bufferSize);
|
||||
if (len < 1)
|
||||
|
@ -499,7 +499,7 @@ int64_t getLastPCR(File& file, int bufferSize, int frameSize, int64_t fileSize)
|
||||
{
|
||||
// pcr from end of file
|
||||
uint8_t* tmpBuffer = new uint8_t[bufferSize];
|
||||
file.seek(FFMAX(fileSize - bufferSize, 0), File::smBegin);
|
||||
file.seek(FFMAX(fileSize - bufferSize, 0), File::SeekMethod::smBegin);
|
||||
int len = file.read(tmpBuffer, bufferSize);
|
||||
if (len < 1)
|
||||
return -2; // read error
|
||||
|
@ -1253,7 +1253,7 @@ bool TSMuxer::appendM2TSNullPacketToFile(uint64_t curFileSize, int counter, int*
|
||||
|
||||
File* file = dynamic_cast<File*>(m_muxFile);
|
||||
|
||||
file->seek(curFileSize - 192, File::smBegin);
|
||||
file->seek(curFileSize - 192, File::SeekMethod::smBegin);
|
||||
int readCnt = file->read(tmpBuff, 192);
|
||||
if (readCnt != 192)
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user