Change Commands enum to enum class

This commit is contained in:
jcdr428 2022-01-09 14:43:40 +01:00
parent 347e0f9045
commit 1471faa8cc
3 changed files with 15 additions and 11 deletions

View File

@ -7,13 +7,15 @@ void WriterData::execute()
{
switch (m_command)
{
case wdWrite:
case Commands::wdWrite:
if (m_mainFile)
{
m_mainFile->write(m_buffer, m_bufferLen);
}
delete[] m_buffer;
break;
default:
break;
};
}
@ -71,7 +73,7 @@ void BufferedFileWriter::terminate()
return;
m_terminated = true;
WriterData data;
data.m_command = WriterData::wdNone;
data.m_command = WriterData::Commands::wdNone;
m_writeQueue.push(data);
join();
}

View File

@ -14,20 +14,22 @@ const unsigned WRITE_QUEUE_MAX_SIZE = 400 * 1024 * 1024 / DEFAULT_FILE_BLOCK_SIZ
struct WriterData
{
uint8_t* m_buffer;
int m_bufferLen;
AbstractOutputStream* m_mainFile;
int m_command;
public:
WriterData() : m_buffer(0), m_bufferLen(0), m_mainFile(), m_command(0) {}
enum Commands
enum class Commands
{
wdNone,
wdWrite,
wdDelete,
wdCloseFile
};
uint8_t* m_buffer;
int m_bufferLen;
AbstractOutputStream* m_mainFile;
Commands m_command;
public:
WriterData() : m_buffer(0), m_bufferLen(0), m_mainFile(), m_command() {}
void execute();
};

View File

@ -288,7 +288,7 @@ void MuxerManager::asyncWriteBuffer(AbstractMuxer* muxer, uint8_t* buff, int len
data.m_buffer = buff;
data.m_bufferLen = len;
data.m_mainFile = dstFile;
data.m_command = WriterData::wdWrite;
data.m_command = WriterData::Commands::wdWrite;
if (m_interleave && muxer == m_mainMuxer)
{