Initialize local variables

This commit is contained in:
jcdr428 2022-01-04 22:36:55 +01:00
parent b4c67d03e8
commit 8854bfbcc4
13 changed files with 61 additions and 61 deletions

View File

@ -13,7 +13,7 @@ void updateBits(const BitStreamReader& bitReader, int bitOffset, int bitLen, int
void updateBits(const uint8_t* buffer, int bitOffset, int bitLen, int value) void updateBits(const uint8_t* buffer, int bitOffset, int bitLen, int value)
{ {
uint8_t* ptr = (uint8_t*)buffer + bitOffset / 8; uint8_t* ptr = (uint8_t*)buffer + bitOffset / 8;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
int byteOffset = bitOffset % 8; int byteOffset = bitOffset % 8;
bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5));
@ -38,10 +38,10 @@ void updateBits(const uint8_t* buffer, int bitOffset, int bitLen, int value)
void moveBits(uint8_t* buffer, int oldBitOffset, int newBitOffset, int len) void moveBits(uint8_t* buffer, int oldBitOffset, int newBitOffset, int len)
{ {
uint8_t* src = (uint8_t*)buffer + (oldBitOffset >> 3); uint8_t* src = (uint8_t*)buffer + (oldBitOffset >> 3);
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(src, src + len / 8 + 1); reader.setBuffer(src, src + len / 8 + 1);
uint8_t* dst = (uint8_t*)buffer + (newBitOffset >> 3); uint8_t* dst = (uint8_t*)buffer + (newBitOffset >> 3);
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(dst, dst + len / 8 + 1); writer.setBuffer(dst, dst + len / 8 + 1);
writer.skipBits(newBitOffset % 8); writer.skipBits(newBitOffset % 8);
if (oldBitOffset % 8) if (oldBitOffset % 8)

View File

@ -173,7 +173,7 @@ class BitStreamWriter : public BitStream
inline void skipBits(unsigned cnt) inline void skipBits(unsigned cnt)
{ {
assert(m_bitWrited % INT_BIT == 0); assert(m_bitWrited % INT_BIT == 0);
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer((uint8_t*)m_buffer, (uint8_t*)(m_buffer + 1)); reader.setBuffer((uint8_t*)m_buffer, (uint8_t*)(m_buffer + 1));
putBits(cnt, reader.getBits(cnt)); putBits(cnt, reader.getBits(cnt));
} }

View File

@ -41,7 +41,7 @@ int DVBSubStreamReader::intDecodeFrame(uint8_t* buff, uint8_t* end)
int pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos; int pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
int cmd_pos, is_8bit = 0; int cmd_pos, is_8bit = 0;
const uint8_t* yuv_palette = 0; const uint8_t* yuv_palette = 0;
uint8_t colormap[4], alpha[256]; uint8_t colormap[4]{0}, alpha[256]{0};
int date; int date;
int i; int i;
int is_menu = 0; int is_menu = 0;

View File

@ -82,7 +82,7 @@ CheckStreamRez H264StreamReader::checkStream(uint8_t* buffer, int len)
std::string tmpDescr; std::string tmpDescr;
bool pulldownInserted = false; bool pulldownInserted = false;
bool offsetsInserted = false; bool offsetsInserted = false;
BitStreamReader bitReader; BitStreamReader bitReader{};
m_last_mb_num = -1; m_last_mb_num = -1;
for (uint8_t* nal = NALUnit::findNextNAL(buffer, end); nal < end - 4; nal = NALUnit::findNextNAL(nal, end)) for (uint8_t* nal = NALUnit::findNextNAL(buffer, end); nal < end - 4; nal = NALUnit::findNextNAL(nal, end))
@ -225,7 +225,7 @@ int H264StreamReader::writeSEIMessage(uint8_t* dstBuffer, uint8_t* dstEnd, SEIUn
THROW(ERR_COMMON, "H264 stream error: Not enough buffer for write headers"); THROW(ERR_COMMON, "H264 stream error: Not enough buffer for write headers");
uint8_t tmpBuffer[256]; uint8_t tmpBuffer[256];
BitStreamWriter writer; BitStreamWriter writer{};
curPos = writeNalPrefix(curPos); curPos = writeNalPrefix(curPos);
writer.setBuffer(tmpBuffer, tmpBuffer + sizeof(tmpBuffer)); writer.setBuffer(tmpBuffer, tmpBuffer + sizeof(tmpBuffer));
@ -1068,7 +1068,7 @@ bool H264StreamReader::findPPSForward(uint8_t* buff)
int H264StreamReader::deserializeSliceHeader(SliceUnit& slice, uint8_t* buff, uint8_t* sliceEnd) int H264StreamReader::deserializeSliceHeader(SliceUnit& slice, uint8_t* buff, uint8_t* sliceEnd)
{ {
int nalRez; int nalRez{};
int maxHeaderSize = sliceEnd - buff; int maxHeaderSize = sliceEnd - buff;
int toDecode = 0; int toDecode = 0;
do do

View File

@ -64,7 +64,7 @@ int HevcUnit::deserialize()
void HevcUnit::updateBits(int bitOffset, int bitLen, int value) void HevcUnit::updateBits(int bitOffset, int bitLen, int value)
{ {
uint8_t* ptr = (uint8_t*)m_reader.getBuffer() + bitOffset / 8; uint8_t* ptr = (uint8_t*)m_reader.getBuffer() + bitOffset / 8;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
int byteOffset = bitOffset % 8; int byteOffset = bitOffset % 8;
bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5));

View File

@ -332,7 +332,7 @@ int HEVCStreamReader::setDoViDescriptor(uint8_t* dstBuff)
else if (width <= 7680 && pixelRate <= 3981312000) else if (width <= 7680 && pixelRate <= 3981312000)
level = 13; level = 13;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
bitWriter.setBuffer(dstBuff, dstBuff + 128); bitWriter.setBuffer(dstBuff, dstBuff + 128);
bitWriter.putBits(8, 0xb0); // DoVi descriptor tag bitWriter.putBits(8, 0xb0); // DoVi descriptor tag

View File

@ -25,7 +25,7 @@ int MPEG2StreamReader::getTSDescriptor(uint8_t* dstBuff, bool blurayMode, bool h
} }
else if (nal[3] == EXT_START_SHORT_CODE) else if (nal[3] == EXT_START_SHORT_CODE)
{ {
BitStreamReader bitReader; BitStreamReader bitReader{};
bitReader.setBuffer(nal + 4, m_bufEnd); bitReader.setBuffer(nal + 4, m_bufEnd);
int extType = bitReader.getBits(4); int extType = bitReader.getBits(4);
if (extType == SEQUENCE_EXT) if (extType == SEQUENCE_EXT)
@ -65,7 +65,7 @@ CheckStreamRez MPEG2StreamReader::checkStream(uint8_t* buffer, int len)
{ {
CheckStreamRez rez; CheckStreamRez rez;
uint8_t* end = buffer + len; uint8_t* end = buffer + len;
BitStreamReader bitReader; BitStreamReader bitReader{};
uint8_t* nextNal = 0; uint8_t* nextNal = 0;
bool spsFound = false; bool spsFound = false;
bool iFrameFound = false; bool iFrameFound = false;
@ -226,7 +226,7 @@ int MPEG2StreamReader::processSeqStartCode(uint8_t* buff)
int MPEG2StreamReader::processExtStartCode(uint8_t* buff) int MPEG2StreamReader::processExtStartCode(uint8_t* buff)
{ {
BitStreamReader bitReader; BitStreamReader bitReader{};
try try
{ {
bitReader.setBuffer(buff + 1, m_bufEnd); bitReader.setBuffer(buff + 1, m_bufEnd);
@ -325,7 +325,7 @@ int MPEG2StreamReader::findFrameExt(uint8_t* buffer)
{ {
if (nal[3] == EXT_START_SHORT_CODE) if (nal[3] == EXT_START_SHORT_CODE)
{ {
BitStreamReader bitReader; BitStreamReader bitReader{};
try try
{ {
bitReader.setBuffer(nal + 4, m_bufEnd); bitReader.setBuffer(nal + 4, m_bufEnd);

View File

@ -68,7 +68,7 @@ MPEGSequenceHeader::MPEGSequenceHeader(int bufferSize) : MPEGRawDataHeader(buffe
uint8_t* MPEGSequenceHeader::deserialize(uint8_t* buf, int buf_size) uint8_t* MPEGSequenceHeader::deserialize(uint8_t* buf, int buf_size)
{ {
BitStreamReader bitReader; BitStreamReader bitReader{};
bitReader.setBuffer(buf, buf + buf_size); bitReader.setBuffer(buf, buf + buf_size);
width = bitReader.getBits(12); width = bitReader.getBits(12);
@ -308,7 +308,7 @@ void MPEGSequenceHeader::setAspectRatio(uint8_t* buff, VideoAspectRatio ar)
// --------------- gop header ------------------ // --------------- gop header ------------------
uint8_t* MPEGGOPHeader::deserialize(uint8_t* buf, int buf_size) uint8_t* MPEGGOPHeader::deserialize(uint8_t* buf, int buf_size)
{ {
BitStreamReader bitReader; BitStreamReader bitReader{};
bitReader.setBuffer(buf, buf + buf_size); bitReader.setBuffer(buf, buf + buf_size);
drop_frame_flag = bitReader.getBit(); drop_frame_flag = bitReader.getBit();
@ -336,7 +336,7 @@ if(s->avctx->debug & FF_DEBUG_PICT_INFO)
uint32_t MPEGGOPHeader::serialize(uint8_t* buffer) uint32_t MPEGGOPHeader::serialize(uint8_t* buffer)
{ {
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
// init_bitWriter.putBits(buffer, 8*8); // 8*8 maximum gop header buffer size at bits // init_bitWriter.putBits(buffer, 8*8); // 8*8 maximum gop header buffer size at bits
bitWriter.setBuffer(buffer, buffer + 8); bitWriter.setBuffer(buffer, buffer + 8);
bitWriter.putBits(1, drop_frame_flag); bitWriter.putBits(1, drop_frame_flag);
@ -371,7 +371,7 @@ MPEGPictureHeader::MPEGPictureHeader(int bufferSize)
void MPEGPictureHeader::buildHeader() void MPEGPictureHeader::buildHeader()
{ {
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
// init_bitWriter.putBits(m_data_buffer, m_max_data_len*8); // init_bitWriter.putBits(m_data_buffer, m_max_data_len*8);
bitWriter.setBuffer(m_data_buffer, m_data_buffer + m_max_data_len); bitWriter.setBuffer(m_data_buffer, m_data_buffer + m_max_data_len);
@ -400,7 +400,7 @@ void MPEGPictureHeader::buildHeader()
void MPEGPictureHeader::buildCodingExtension() void MPEGPictureHeader::buildCodingExtension()
{ {
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
// init_bitWriter.putBits(m_data_buffer + m_data_buffer_len, (m_max_data_len - m_data_buffer_len)*8); // init_bitWriter.putBits(m_data_buffer + m_data_buffer_len, (m_max_data_len - m_data_buffer_len)*8);
uint8_t* bufPtr = m_data_buffer + m_data_buffer_len; uint8_t* bufPtr = m_data_buffer + m_data_buffer_len;
bitWriter.setBuffer(bufPtr, bufPtr + m_max_data_len - m_data_buffer_len); bitWriter.setBuffer(bufPtr, bufPtr + m_max_data_len - m_data_buffer_len);
@ -621,7 +621,7 @@ uint32_t MPEGPictureHeader::serialize(uint8_t* buffer)
void MPEGSliceHeader::deserialize(uint8_t* buf, int buf_size) void MPEGSliceHeader::deserialize(uint8_t* buf, int buf_size)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buf, buf + buf_size); reader.setBuffer(buf, buf + buf_size);
quantiser_scale_code = reader.getBits(5); quantiser_scale_code = reader.getBits(5);
if (reader.getBit()) if (reader.getBit())

View File

@ -196,7 +196,7 @@ int NALUnit::decodeNAL2(uint8_t* srcBuffer, uint8_t* srcEnd, uint8_t* dstBuffer,
unsigned NALUnit::extractUEGolombCode(uint8_t* buffer, uint8_t* bufEnd) unsigned NALUnit::extractUEGolombCode(uint8_t* buffer, uint8_t* bufEnd)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, bufEnd); reader.setBuffer(buffer, bufEnd);
return extractUEGolombCode(reader); return extractUEGolombCode(reader);
} }
@ -601,10 +601,10 @@ int SPSUnit::deserialize()
int seq_scaling_matrix_present_flag = bitReader.getBits(1); int seq_scaling_matrix_present_flag = bitReader.getBits(1);
if (seq_scaling_matrix_present_flag != 0) if (seq_scaling_matrix_present_flag != 0)
{ {
int ScalingList4x4[6][16]; int ScalingList4x4[6][16]{};
int ScalingList8x8[2][64]; int ScalingList8x8[2][64]{};
bool UseDefaultScalingMatrix4x4Flag[6]; bool UseDefaultScalingMatrix4x4Flag[6]{};
bool UseDefaultScalingMatrix8x8Flag[2]; bool UseDefaultScalingMatrix8x8Flag[2]{};
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
@ -900,9 +900,9 @@ void SPSUnit::updateTimingInfo()
int beforeBytes = bitPos >> 3; int beforeBytes = bitPos >> 3;
memcpy(newNalBuffer, m_nalBuffer, m_nalBufferLen); memcpy(newNalBuffer, m_nalBuffer, m_nalBufferLen);
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(m_nalBuffer + beforeBytes, m_nalBuffer + m_nalBufferLen); reader.setBuffer(m_nalBuffer + beforeBytes, m_nalBuffer + m_nalBufferLen);
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(newNalBuffer + beforeBytes, newNalBuffer + m_nalBufferLen + EXTRA_SPACE); writer.setBuffer(newNalBuffer + beforeBytes, newNalBuffer + m_nalBufferLen + EXTRA_SPACE);
int tmpVal = reader.getBits(bitPos & 7); int tmpVal = reader.getBits(bitPos & 7);
writer.putBits(bitPos & 7, tmpVal); writer.putBits(bitPos & 7, tmpVal);
@ -958,9 +958,9 @@ void SPSUnit::insertHrdData(int bitPos, int nal_hrd_len, int vcl_hrd_len, bool a
int beforeBytes = bitPos >> 3; int beforeBytes = bitPos >> 3;
memcpy(newNalBuffer, m_nalBuffer, m_nalBufferLen); memcpy(newNalBuffer, m_nalBuffer, m_nalBufferLen);
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(m_nalBuffer + beforeBytes, m_nalBuffer + m_nalBufferLen); reader.setBuffer(m_nalBuffer + beforeBytes, m_nalBuffer + m_nalBufferLen);
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(newNalBuffer + beforeBytes, newNalBuffer + m_nalBufferLen + EXTRA_SPACE); writer.setBuffer(newNalBuffer + beforeBytes, newNalBuffer + m_nalBufferLen + EXTRA_SPACE);
int tmpVal = reader.getBits(bitPos & 7); int tmpVal = reader.getBits(bitPos & 7);
writer.putBits(bitPos & 7, tmpVal); writer.putBits(bitPos & 7, tmpVal);
@ -1447,7 +1447,7 @@ void NALUnit::updateBits(int bitOffset, int bitLen, int value)
{ {
// uint8_t* ptr = m_getbitContextBuffer + (bitOffset/8); // uint8_t* ptr = m_getbitContextBuffer + (bitOffset/8);
uint8_t* ptr = (uint8_t*)bitReader.getBuffer() + bitOffset / 8; uint8_t* ptr = (uint8_t*)bitReader.getBuffer() + bitOffset / 8;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
int byteOffset = bitOffset % 8; int byteOffset = bitOffset % 8;
bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5));
@ -2071,7 +2071,7 @@ int SEIUnit::removePicTimingSEI(SPSUnit& sps)
{ {
uint8_t* nalEnd = m_nalBuffer + m_nalBufferLen; uint8_t* nalEnd = m_nalBuffer + m_nalBufferLen;
uint8_t* curBuff = m_nalBuffer + 1; uint8_t* curBuff = m_nalBuffer + 1;
uint8_t tmpBuffer[1024 * 4]; uint8_t tmpBuffer[1024 * 4]{};
tmpBuffer[0] = m_nalBuffer[0]; tmpBuffer[0] = m_nalBuffer[0];
int tmpBufferLen = 1; int tmpBufferLen = 1;

View File

@ -56,7 +56,7 @@ bool TSDemuxer::mvcContinueExpected() const
void TSDemuxer::getTrackList(std::map<uint32_t, TrackInfo>& trackList) void TSDemuxer::getTrackList(std::map<uint32_t, TrackInfo>& trackList)
{ {
uint8_t pmtBuffer[4096]; uint8_t pmtBuffer[4096]{0};
int pmtBufferLen = 0; int pmtBufferLen = 0;
uint32_t tmpBufferLen = 0; uint32_t tmpBufferLen = 0;
uint32_t readedBytes; uint32_t readedBytes;
@ -195,7 +195,7 @@ int TSDemuxer::simpleDemuxBlock(DemuxedData& demuxedData, const PIDSet& accepted
m_firstDemuxCall = false; m_firstDemuxCall = false;
} }
uint8_t pmtBuffer[4096]; uint8_t pmtBuffer[4096]{0};
int pmtBufferLen = 0; int pmtBufferLen = 0;
MemoryBlock* vect = 0; MemoryBlock* vect = 0;
int lastPid = -1; int lastPid = -1;
@ -561,7 +561,7 @@ int64_t getTSDuration(const char* fileName)
} }
delete[] tmpBuffer; delete[] tmpBuffer;
int64_t lastPcrVal; int64_t lastPcrVal{};
bufferSize = 1024 * 256; bufferSize = 1024 * 256;
bufferSize -= bufferSize % frameSize; bufferSize -= bufferSize % frameSize;
do do

View File

@ -633,7 +633,7 @@ void TSMuxer::buildPesHeader(int pesStreamID, AVPacket& avPacket, int pid)
{ {
int64_t curDts = nanoClockToPts(avPacket.dts) + m_timeOffset; int64_t curDts = nanoClockToPts(avPacket.dts) + m_timeOffset;
int64_t curPts = nanoClockToPts(avPacket.pts) + m_timeOffset; int64_t curPts = nanoClockToPts(avPacket.pts) + m_timeOffset;
uint8_t tmpBuffer[2048]; uint8_t tmpBuffer[2048]{0};
PESPacket* pesPacket = (PESPacket*)tmpBuffer; PESPacket* pesPacket = (PESPacket*)tmpBuffer;
if (curDts != curPts) if (curDts != curPts)
pesPacket->serialize(curPts, curDts, pesStreamID); pesPacket->serialize(curPts, curDts, pesStreamID);

View File

@ -42,7 +42,7 @@ bool isAudioStreamType(int stream_coding_type)
bool PS_stream_pack::deserialize(uint8_t* buffer, int buf_size) bool PS_stream_pack::deserialize(uint8_t* buffer, int buf_size)
{ {
m_pts = 0; m_pts = 0;
BitStreamReader bitReader; BitStreamReader bitReader{};
bitReader.setBuffer(buffer, buffer + buf_size); bitReader.setBuffer(buffer, buffer + buf_size);
if (bitReader.getBits(2) != 1) if (bitReader.getBits(2) != 1)
return false; // 0b01 required return false; // 0b01 required
@ -96,7 +96,7 @@ bool TS_program_association_section::deserialize(uint8_t* buffer, int buf_size)
{ {
m_nitPID = -1; m_nitPID = -1;
buffer++; buffer++;
BitStreamReader bitReader; BitStreamReader bitReader{};
try try
{ {
bitReader.setBuffer(buffer, buffer + buf_size); bitReader.setBuffer(buffer, buffer + buf_size);
@ -151,7 +151,7 @@ uint32_t TS_program_association_section::serialize(uint8_t* buffer, int buf_size
{ {
buffer[0] = 0; buffer[0] = 0;
buffer++; buffer++;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
// init_bitWriter.putBits(buffer, buf_size*8); // init_bitWriter.putBits(buffer, buf_size*8);
bitWriter.setBuffer(buffer, buffer + buf_size); bitWriter.setBuffer(buffer, buffer + buf_size);
@ -200,7 +200,7 @@ bool TS_program_map_section::isFullBuff(uint8_t* buffer, int buf_size)
{ {
uint8_t pointerField = *buffer; uint8_t pointerField = *buffer;
uint8_t* bufEnd = buffer + buf_size; uint8_t* bufEnd = buffer + buf_size;
BitStreamReader bitReader; BitStreamReader bitReader{};
try try
{ {
bitReader.setBuffer(buffer + 1 + pointerField, buffer + buf_size); bitReader.setBuffer(buffer + 1 + pointerField, buffer + buf_size);
@ -250,7 +250,7 @@ bool TS_program_map_section::deserialize(uint8_t* buffer, int buf_size)
return false; return false;
uint8_t pointerField = *buffer; uint8_t pointerField = *buffer;
uint8_t* bufferEnd = buffer + buf_size; uint8_t* bufferEnd = buffer + buf_size;
BitStreamReader bitReader; BitStreamReader bitReader{};
try try
{ {
bitReader.setBuffer(buffer + 1 + pointerField, buffer + buf_size); bitReader.setBuffer(buffer + 1 + pointerField, buffer + buf_size);
@ -374,7 +374,7 @@ uint32_t TS_program_map_section::serialize(uint8_t* buffer, int max_buf_size, bo
{ {
buffer[0] = 0; buffer[0] = 0;
buffer++; buffer++;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
bitWriter.setBuffer(buffer, buffer + max_buf_size); bitWriter.setBuffer(buffer, buffer + max_buf_size);
bitWriter.putBits(8, 2); // table id bitWriter.putBits(8, 2); // table id
@ -626,7 +626,7 @@ void CLPIStreamInfo::composeStreamCodingInfo(BitStreamWriter& writer) const
void CLPIParser::parseProgramInfo(uint8_t* buffer, uint8_t* end, std::vector<CLPIProgramInfo>& programInfoMap, void CLPIParser::parseProgramInfo(uint8_t* buffer, uint8_t* end, std::vector<CLPIProgramInfo>& programInfoMap,
std::map<int, CLPIStreamInfo>& streamInfoMap) std::map<int, CLPIStreamInfo>& streamInfoMap)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, end); reader.setBuffer(buffer, end);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
reader.skipBits(8); // reserved_for_word_align reader.skipBits(8); // reserved_for_word_align
@ -777,7 +777,7 @@ void CLPIParser::composeClipInfo(BitStreamWriter& writer)
void CLPIParser::parseSequenceInfo(uint8_t* buffer, uint8_t* end) void CLPIParser::parseSequenceInfo(uint8_t* buffer, uint8_t* end)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, end); reader.setBuffer(buffer, end);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
reader.skipBits(8); // reserved_for_word_align 8 bslbf reader.skipBits(8); // reserved_for_word_align 8 bslbf
@ -823,7 +823,7 @@ void CLPIParser::composeSequenceInfo(BitStreamWriter& writer)
void CLPIParser::parseCPI(uint8_t* buffer, uint8_t* end) void CLPIParser::parseCPI(uint8_t* buffer, uint8_t* end)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, end); reader.setBuffer(buffer, end);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
if (length != 0) if (length != 0)
@ -1019,7 +1019,7 @@ void CLPIParser::composeEP_map_for_one_stream_PID(BitStreamWriter& writer, M2TSS
void CLPIParser::parseClipMark(uint8_t* buffer, uint8_t* end) void CLPIParser::parseClipMark(uint8_t* buffer, uint8_t* end)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, end); reader.setBuffer(buffer, end);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
} }
@ -1057,7 +1057,7 @@ void CLPIParser::HDMV_LPCM_down_mix_coefficient(uint8_t* buffer, int dataLength)
void CLPIParser::Extent_Start_Point(uint8_t* buffer, int dataLength) void CLPIParser::Extent_Start_Point(uint8_t* buffer, int dataLength)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, buffer + dataLength); reader.setBuffer(buffer, buffer + dataLength);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
@ -1171,7 +1171,7 @@ void CLPIParser::composeExtentInfo(BitStreamWriter& writer)
void CLPIParser::parseExtensionData(uint8_t* buffer, uint8_t* end) void CLPIParser::parseExtensionData(uint8_t* buffer, uint8_t* end)
{ {
// added for 3D compatibility // added for 3D compatibility
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, end); reader.setBuffer(buffer, end);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
if (length == 0) if (length == 0)
@ -1212,7 +1212,7 @@ void CLPIParser::parseExtensionData(uint8_t* buffer, uint8_t* end)
void CLPIParser::parse(uint8_t* buffer, int len) void CLPIParser::parse(uint8_t* buffer, int len)
{ {
BitStreamReader reader; BitStreamReader reader{};
try try
{ {
reader.setBuffer(buffer, buffer + len); reader.setBuffer(buffer, buffer + len);
@ -1247,7 +1247,7 @@ void CLPIParser::parse(uint8_t* buffer, int len)
int CLPIParser::compose(uint8_t* buffer, int bufferSize) int CLPIParser::compose(uint8_t* buffer, int bufferSize)
{ {
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
CLPIStreamInfo::writeString("HDMV", writer, 4); CLPIStreamInfo::writeString("HDMV", writer, 4);
CLPIStreamInfo::writeString(version_number, writer, 4); CLPIStreamInfo::writeString(version_number, writer, 4);
@ -1348,7 +1348,7 @@ bool MPLSParser::parse(const char* fileName)
void MPLSParser::parse(uint8_t* buffer, int len) void MPLSParser::parse(uint8_t* buffer, int len)
{ {
BitStreamReader reader; BitStreamReader reader{};
try try
{ {
reader.setBuffer(buffer, buffer + len); reader.setBuffer(buffer, buffer + len);
@ -1415,7 +1415,7 @@ void MPLSParser::SubPath_extension(BitStreamWriter& writer)
int MPLSParser::composeSubPathEntryExtension(uint8_t* buffer, int bufferSize) int MPLSParser::composeSubPathEntryExtension(uint8_t* buffer, int bufferSize)
{ {
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
try try
{ {
@ -1442,7 +1442,7 @@ int MPLSParser::composeSubPathEntryExtension(uint8_t* buffer, int bufferSize)
int MPLSParser::composeSTN_tableSS(uint8_t* buffer, int bufferSize) int MPLSParser::composeSTN_tableSS(uint8_t* buffer, int bufferSize)
{ {
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
try try
{ {
@ -1463,7 +1463,7 @@ int MPLSParser::composeSTN_tableSS(uint8_t* buffer, int bufferSize)
int MPLSParser::composeUHD_metadata(uint8_t* buffer, int bufferSize) int MPLSParser::composeUHD_metadata(uint8_t* buffer, int bufferSize)
{ {
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
try try
{ {
@ -1500,7 +1500,7 @@ int MPLSParser::compose(uint8_t* buffer, int bufferSize, DiskType dt)
} }
} }
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
std::string type_indicator = "MPLS"; std::string type_indicator = "MPLS";
@ -1628,7 +1628,7 @@ void MPLSParser::UO_mask_table(BitStreamReader& reader)
void MPLSParser::parsePlayList(uint8_t* buffer, int len) void MPLSParser::parsePlayList(uint8_t* buffer, int len)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, buffer + len); reader.setBuffer(buffer, buffer + len);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
reader.skipBits(16); // reserved_for_future_use 16 bslbf reader.skipBits(16); // reserved_for_future_use 16 bslbf
@ -1819,7 +1819,7 @@ void MPLSParser::composeSubPlayItem(BitStreamWriter& writer, int playItemNum, in
int MPLSParser::composePip_metadata(uint8_t* buffer, int bufferSize, std::vector<PMTIndex>& pmtIndexList) int MPLSParser::composePip_metadata(uint8_t* buffer, int bufferSize, std::vector<PMTIndex>& pmtIndexList)
{ {
// The ID1 value and the ID2 value of the ExtensionData() shall be set to 0x0001 and 0x0001 // The ID1 value and the ID2 value of the ExtensionData() shall be set to 0x0001 and 0x0001
BitStreamWriter writer; BitStreamWriter writer{};
writer.setBuffer(buffer, buffer + bufferSize); writer.setBuffer(buffer, buffer + bufferSize);
uint32_t* lengthPos = (uint32_t*)buffer; uint32_t* lengthPos = (uint32_t*)buffer;
writer.putBits(32, 0); // int length = reader.getBits(8); //8 uimsbf writer.putBits(32, 0); // int length = reader.getBits(8); //8 uimsbf
@ -1930,7 +1930,7 @@ void MPLSParser::parseStnTableSS(uint8_t* data, int dataLength)
{ {
try try
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(data, data + dataLength); reader.setBuffer(data, data + dataLength);
int len = reader.getBits(16); int len = reader.getBits(16);
bool fixedOffsetDuringPopup = reader.getBit(); bool fixedOffsetDuringPopup = reader.getBit();
@ -1999,7 +1999,7 @@ void MPLSParser::parseStnTableSS(uint8_t* data, int dataLength)
void MPLSParser::parseSubPathEntryExtension(uint8_t* data, int dataLen) void MPLSParser::parseSubPathEntryExtension(uint8_t* data, int dataLen)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(data, data + dataLen); reader.setBuffer(data, data + dataLen);
try try
{ {
@ -2056,7 +2056,7 @@ void MPLSParser::parseExtensionData(uint8_t* data, uint8_t* dataEnd)
{ {
try try
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(data, dataEnd); reader.setBuffer(data, dataEnd);
uint32_t length = reader.getBits(32); uint32_t length = reader.getBits(32);
if (length == 0) if (length == 0)
@ -2225,7 +2225,7 @@ void MPLSParser::composePlayItem(BitStreamWriter& writer, int playItemNum, std::
void MPLSParser::parsePlayListMark(uint8_t* buffer, int len) void MPLSParser::parsePlayListMark(uint8_t* buffer, int len)
{ {
BitStreamReader reader; BitStreamReader reader{};
reader.setBuffer(buffer, buffer + len); reader.setBuffer(buffer, buffer + len);
uint32_t length = reader.getBits(32); // uint32_t length = reader.getBits(32); //
int number_of_PlayList_marks = reader.getBits(16); // 16 uimsbf int number_of_PlayList_marks = reader.getBits(16); // 16 uimsbf

View File

@ -64,7 +64,7 @@ int VvcUnit::deserialize()
void VvcUnit::updateBits(int bitOffset, int bitLen, int value) void VvcUnit::updateBits(int bitOffset, int bitLen, int value)
{ {
uint8_t* ptr = (uint8_t*)m_reader.getBuffer() + bitOffset / 8; uint8_t* ptr = (uint8_t*)m_reader.getBuffer() + bitOffset / 8;
BitStreamWriter bitWriter; BitStreamWriter bitWriter{};
int byteOffset = bitOffset % 8; int byteOffset = bitOffset % 8;
bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5));