diff --git a/libmediation/types/types.cpp b/libmediation/types/types.cpp index 823a7dd3..efe655e9 100644 --- a/libmediation/types/types.cpp +++ b/libmediation/types/types.cpp @@ -461,12 +461,12 @@ char* strnstr(char* s1, const char* s2, const size_t len) size_t l1 = len; const size_t l2 = strlen(s2); if (!l2) - return (char*)s1; + return s1; while (l1 >= l2) { l1--; if (!memcmp(s1, s2, l2)) - return (char*)s1; + return s1; s1++; } return nullptr; @@ -476,7 +476,7 @@ uint32_t random32() { static std::random_device dev; static std::minstd_rand raand(dev()); - return static_cast(raand()); + return raand(); } #ifdef _WIN32 diff --git a/tsMuxer/aacStreamReader.cpp b/tsMuxer/aacStreamReader.cpp index aa277be7..02c99656 100644 --- a/tsMuxer/aacStreamReader.cpp +++ b/tsMuxer/aacStreamReader.cpp @@ -9,7 +9,7 @@ const std::string AACStreamReader::getStreamInfo() { std::ostringstream str; str << "Sample Rate: " << m_sample_rate / 1000 << "KHz "; - str << "Channels: " << (int)m_channels; + str << "Channels: " << m_channels; return str.str(); } diff --git a/tsMuxer/ac3Codec.cpp b/tsMuxer/ac3Codec.cpp index ce28e8f4..dd1426a9 100644 --- a/tsMuxer/ac3Codec.cpp +++ b/tsMuxer/ac3Codec.cpp @@ -555,9 +555,9 @@ const std::string AC3Codec::getStreamInfo() channels = mlp.m_channels; if (m_lfeon) - str << (int)(channels - 1) << ".1"; + str << channels - 1 << ".1"; else - str << (int)channels; + str << channels; return str.str(); } diff --git a/tsMuxer/bitStream.cpp b/tsMuxer/bitStream.cpp index c89a7291..a81d80a5 100644 --- a/tsMuxer/bitStream.cpp +++ b/tsMuxer/bitStream.cpp @@ -9,12 +9,12 @@ void updateBits(const BitStreamReader& bitReader, const int bitOffset, const int void updateBits(uint8_t* buffer, const int bitOffset, const int bitLen, const int value) { - uint8_t* ptr = (uint8_t*)buffer + bitOffset / 8; + uint8_t* ptr = buffer + bitOffset / 8; BitStreamWriter bitWriter{}; const int byteOffset = bitOffset % 8; bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); - const uint8_t* ptr_end = (uint8_t*)buffer + (bitOffset + bitLen) / 8; + const uint8_t* ptr_end = buffer + (bitOffset + bitLen) / 8; const int endBitsPostfix = 8 - ((bitOffset + bitLen) % 8); if (byteOffset > 0) @@ -34,10 +34,10 @@ void updateBits(uint8_t* buffer, const int bitOffset, const int bitLen, const in void moveBits(uint8_t* buffer, const int oldBitOffset, const int newBitOffset, int len) { - uint8_t* src = (uint8_t*)buffer + (oldBitOffset >> 3); + uint8_t* src = buffer + (oldBitOffset >> 3); BitStreamReader reader{}; reader.setBuffer(src, src + len / 8 + 1); - uint8_t* dst = (uint8_t*)buffer + (newBitOffset >> 3); + uint8_t* dst = buffer + (newBitOffset >> 3); BitStreamWriter writer{}; writer.setBuffer(dst, dst + len / 8 + 1); writer.skipBits(newBitOffset % 8); diff --git a/tsMuxer/combinedH264Demuxer.cpp b/tsMuxer/combinedH264Demuxer.cpp index 96451554..fa7f37b7 100644 --- a/tsMuxer/combinedH264Demuxer.cpp +++ b/tsMuxer/combinedH264Demuxer.cpp @@ -122,7 +122,7 @@ void CombinedH264Reader::fillPids(const PIDSet& acceptedPIDs, const int pid) CombinedH264Demuxer::CombinedH264Demuxer(const BufferedReaderManager& readManager, const char* streamName) : AbstractDemuxer(), CombinedH264Reader(), m_readManager(readManager) { - m_bufferedReader = (const_cast(m_readManager)).getReader(streamName); + m_bufferedReader = m_readManager.getReader(streamName); m_readerID = m_bufferedReader->createReader(MAX_TMP_BUFFER_SIZE); if (m_bufferedReader == nullptr) THROW(ERR_COMMON, diff --git a/tsMuxer/dtsStreamReader.cpp b/tsMuxer/dtsStreamReader.cpp index df1594cf..ca0b1101 100644 --- a/tsMuxer/dtsStreamReader.cpp +++ b/tsMuxer/dtsStreamReader.cpp @@ -595,7 +595,7 @@ int DTSStreamReader::decodeFrame(uint8_t* buff, uint8_t* end, int& skipBytes, in const auto exHeader = reinterpret_cast(curPtr32); const int dataRest = static_cast(buff + i_frame_size - exHeader); const int frameSize = - (int)((exHeader[0] << 2) + (exHeader[1] >> 6) - 4); // remove 4 bytes of ext world + (exHeader[0] << 2) + (exHeader[1] >> 6) - 4; // remove 4 bytes of ext world if (dataRest - frameSize == 0 || dataRest - frameSize == 1) { m_dtsEsChannels = (static_cast(exHeader[1]) >> 2) & 0x07; diff --git a/tsMuxer/ioContextDemuxer.cpp b/tsMuxer/ioContextDemuxer.cpp index 0ae0865e..c62794f9 100644 --- a/tsMuxer/ioContextDemuxer.cpp +++ b/tsMuxer/ioContextDemuxer.cpp @@ -31,7 +31,7 @@ IOContextDemuxer::IOContextDemuxer(const BufferedReaderManager& readManager) : tracks(), m_readManager(readManager), m_lastReadRez(0) { m_lastProcessedBytes = 0; - m_bufferedReader = (const_cast(m_readManager)).getReader(""); + m_bufferedReader = m_readManager.getReader(""); m_readerID = m_bufferedReader->createReader(TS_FRAME_SIZE); m_curPos = m_bufEnd = nullptr; m_processedBytes = 0; diff --git a/tsMuxer/lpcmStreamReader.cpp b/tsMuxer/lpcmStreamReader.cpp index fbdb4df7..70643bf3 100644 --- a/tsMuxer/lpcmStreamReader.cpp +++ b/tsMuxer/lpcmStreamReader.cpp @@ -616,9 +616,9 @@ const std::string LPCMStreamReader::getStreamInfo() str << "Sample Rate: " << m_freq / 1000 << "KHz "; str << "Channels: "; if (m_lfeExists) - str << (int)m_channels - 1 << ".1"; + str << m_channels - 1 << ".1"; else - str << (int)m_channels; + str << m_channels; str << " Bits per sample: " << m_bitsPerSample << "bit"; return str.str(); } diff --git a/tsMuxer/main.cpp b/tsMuxer/main.cpp index dea616f4..5b22e9b9 100644 --- a/tsMuxer/main.cpp +++ b/tsMuxer/main.cpp @@ -220,13 +220,13 @@ string getBlurayStreamDir(const string& mplsName) { string dirName = extractFileDir(mplsName); dirName = toNativeSeparators(dirName); - size_t tmp = dirName.substr(0, (size_t)(dirName.size() - 1)).find_last_of(getDirSeparator()); + size_t tmp = dirName.substr(0, dirName.size() - 1).find_last_of(getDirSeparator()); if (tmp != string::npos) { dirName = dirName.substr(0, tmp + 1); if (strEndWith(dirName, string("BACKUP") + getDirSeparator())) { - tmp = dirName.substr(0, (size_t)(dirName.size() - 1)).find_last_of(getDirSeparator()); + tmp = dirName.substr(0, dirName.size() - 1).find_last_of(getDirSeparator()); if (tmp == string::npos) return ""; dirName = dirName.substr(0, tmp + 1); diff --git a/tsMuxer/matroskaDemuxer.cpp b/tsMuxer/matroskaDemuxer.cpp index ce71b9ac..2a713c48 100644 --- a/tsMuxer/matroskaDemuxer.cpp +++ b/tsMuxer/matroskaDemuxer.cpp @@ -466,7 +466,7 @@ void MatroskaDemuxer::decompressData(uint8_t *data, const int size) return; zstream.avail_in = size; - zstream.next_in = (Bytef *)data; + zstream.next_in = data; int curSize = size; do { diff --git a/tsMuxer/metaDemuxer.cpp b/tsMuxer/metaDemuxer.cpp index 063a2df0..bc42f856 100644 --- a/tsMuxer/metaDemuxer.cpp +++ b/tsMuxer/metaDemuxer.cpp @@ -429,7 +429,7 @@ int METADemuxer::addStream(const string codec, const string& codecStreamName, co } else { - dataReader = (const_cast(m_readManager)).getReader(fileList[0].c_str()); + dataReader = m_readManager.getReader(fileList[0].c_str()); } } else if (strEndWith(tmpname, ".ts") || strEndWith(tmpname, ".m2ts") || strEndWith(tmpname, ".mts") || @@ -482,7 +482,7 @@ int METADemuxer::addStream(const string codec, const string& codecStreamName, co } else { - dataReader = (const_cast(m_readManager)).getReader(fileList[0].c_str()); + dataReader = m_readManager.getReader(fileList[0].c_str()); } if (dataReader == nullptr) { diff --git a/tsMuxer/movDemuxer.cpp b/tsMuxer/movDemuxer.cpp index fda9f4e2..66bdaade 100644 --- a/tsMuxer/movDemuxer.cpp +++ b/tsMuxer/movDemuxer.cpp @@ -1280,7 +1280,7 @@ int MovDemuxer::mov_read_extradata(const MOVAtom atom) uint8_t* buf = st->codec_priv + oldSize; // !!! PROBLEM WITH MP4 SIZE ABOVE 4GB: TODO... - AV_WB32(buf, (uint32_t)(atom.size + 8)); + AV_WB32(buf, static_cast(atom.size) + 8); AV_WB32(buf + 4, my_htonl(atom.type)); get_buffer(buf + 8, static_cast(atom.size)); st->codec_priv_size = static_cast(newSize); diff --git a/tsMuxer/mpegAudioStreamReader.cpp b/tsMuxer/mpegAudioStreamReader.cpp index 0365f691..0143df00 100644 --- a/tsMuxer/mpegAudioStreamReader.cpp +++ b/tsMuxer/mpegAudioStreamReader.cpp @@ -37,7 +37,7 @@ const std::string MpegAudioStreamReader::getStreamInfo() std::ostringstream str; str << "Bitrate: " << m_bit_rate / 1000 << "Kbps "; str << "Sample Rate: " << m_sample_rate / 1000 << "KHz "; - str << "Channels: " << (int)m_nb_channels << " "; + str << "Channels: " << m_nb_channels << " "; str << "Layer: " << m_layer; return str.str(); } diff --git a/tsMuxer/mpegVideo.cpp b/tsMuxer/mpegVideo.cpp index c9bebc32..65ed3d77 100644 --- a/tsMuxer/mpegVideo.cpp +++ b/tsMuxer/mpegVideo.cpp @@ -174,7 +174,7 @@ uint8_t* MPEGSequenceHeader::deserializeExtension(BitStreamReader& bitReader) uint8_t* MPEGSequenceHeader::deserializeMatrixExtension(BitStreamReader& bitReader) { - return (uint8_t*)bitReader.getBuffer(); + return bitReader.getBuffer(); } uint8_t* MPEGSequenceHeader::deserializeDisplayExtension(BitStreamReader& bitReader) diff --git a/tsMuxer/nalUnits.cpp b/tsMuxer/nalUnits.cpp index 9ebce57d..b55962be 100644 --- a/tsMuxer/nalUnits.cpp +++ b/tsMuxer/nalUnits.cpp @@ -1283,12 +1283,12 @@ int SliceUnit::deserialize(uint8_t* buffer, uint8_t* end, const std::map 0) diff --git a/tsMuxer/programStreamDemuxer.cpp b/tsMuxer/programStreamDemuxer.cpp index 6db5c1c2..76fe107d 100644 --- a/tsMuxer/programStreamDemuxer.cpp +++ b/tsMuxer/programStreamDemuxer.cpp @@ -15,7 +15,7 @@ ProgramStreamDemuxer::ProgramStreamDemuxer(const BufferedReaderManager& readMana { memset(m_psm_es_type, 0, sizeof(m_psm_es_type)); memset(m_lpcpHeaderAdded, 0, sizeof(m_lpcpHeaderAdded)); - m_bufferedReader = (const_cast(m_readManager)).getReader(m_streamName.c_str()); + m_bufferedReader = m_readManager.getReader(m_streamName.c_str()); m_readerID = m_bufferedReader->createReader(MAX_PES_HEADER_SIZE); m_lastReadRez = 0; m_lastPesLen = 0; diff --git a/tsMuxer/psgStreamReader.cpp b/tsMuxer/psgStreamReader.cpp index 8f4983de..ae3ed1c6 100644 --- a/tsMuxer/psgStreamReader.cpp +++ b/tsMuxer/psgStreamReader.cpp @@ -430,8 +430,8 @@ int PGSStreamReader::readPacket(AVPacket& avPacket) PGSRenderedBlock& block = m_renderedBlocks[0]; avPacket.data = block.data; avPacket.size = FFMIN(MAX_AV_PACKET_SIZE, block.len); - avPacket.pts = (int64_t)(block.pts * INT_FREQ_TO_TS_FREQ); - avPacket.dts = (int64_t)(block.dts * INT_FREQ_TO_TS_FREQ); + avPacket.pts = block.pts * INT_FREQ_TO_TS_FREQ; + avPacket.dts = block.dts * INT_FREQ_TO_TS_FREQ; block.data += avPacket.size; block.len -= avPacket.size; if (block.len == 0) @@ -593,7 +593,7 @@ int PGSStreamReader::readPacket(AVPacket& avPacket) return NEED_MORE_DATA; } const uint8_t segment_type = *m_curPos; - const auto segment_len = (uint16_t)AV_RB16(m_curPos + 1); + const auto segment_len = AV_RB16(m_curPos + 1); if (m_bufEnd - m_curPos < 3ll + segment_len) { m_tmpBufferLen = m_bufEnd - m_curPos; @@ -722,7 +722,7 @@ int PGSStreamReader::flushPacket(AVPacket& avPacket) { return 0; } void PGSStreamReader::setBuffer(uint8_t* data, const int dataLen, bool lastBlock) { - if ((size_t)(m_tmpBufferLen + dataLen) > m_tmpBuffer.size()) + if (m_tmpBufferLen + dataLen > m_tmpBuffer.size()) m_tmpBuffer.resize(m_tmpBufferLen + dataLen); if (!m_tmpBuffer.empty()) @@ -792,7 +792,7 @@ void PGSStreamReader::intDecodeStream(uint8_t* buffer, const size_t len) } const uint8_t segment_type = *curPos; - const auto segment_len = (uint16_t)AV_RB16(curPos + 1); + const auto segment_len = AV_RB16(curPos + 1); if (bufEnd - curPos < 3ll + segment_len) return; diff --git a/tsMuxer/textSubtitles.cpp b/tsMuxer/textSubtitles.cpp index fa85b971..abf66a49 100644 --- a/tsMuxer/textSubtitles.cpp +++ b/tsMuxer/textSubtitles.cpp @@ -422,12 +422,12 @@ uint8_t* TextToPGSConverter::doConvert(std::string& text, const TextAnimation& a { palette_update_flag = 1; m_paletteVersion++; - curPos += composePresentationSegment(curPos, CompositionMode::Update, (int64_t)updateTime, - (int64_t)updateTime - windowsTransferTime, objectWindowTop, true, forced); + curPos += composePresentationSegment(curPos, CompositionMode::Update, updateTime, + updateTime - windowsTransferTime, objectWindowTop, true, forced); curPos += - composePaletteDefinition(buildPalette(toCurve(opacity)), curPos, (int64_t)updateTime - windowsTransferTime, - (int64_t)updateTime - windowsTransferTime); - curPos += composeEnd(curPos, (int64_t)updateTime - 90, (int64_t)updateTime - 90); + composePaletteDefinition(buildPalette(toCurve(opacity)), curPos, updateTime - windowsTransferTime, + updateTime - windowsTransferTime); + curPos += composeEnd(curPos, updateTime - 90, updateTime - 90); updateTime = static_cast(alignToGrid(updateTime + fpsPts)); opacity -= opacityOutDelta; diff --git a/tsMuxer/tsDemuxer.cpp b/tsMuxer/tsDemuxer.cpp index 2f35a495..1ebfd2d6 100644 --- a/tsMuxer/tsDemuxer.cpp +++ b/tsMuxer/tsDemuxer.cpp @@ -17,7 +17,7 @@ bool isM2TSExt(const std::string& streamName) TSDemuxer::TSDemuxer(const BufferedReaderManager& readManager, const char* streamName) : m_readManager(readManager) { m_firstPCRTime = -1; - m_bufferedReader = (const_cast(m_readManager)).getReader(streamName); + m_bufferedReader = m_readManager.getReader(streamName); m_readerID = m_bufferedReader->createReader(TS_FRAME_SIZE); if (m_bufferedReader == nullptr) THROW(ERR_COMMON, diff --git a/tsMuxer/tsMuxer.cpp b/tsMuxer/tsMuxer.cpp index cdfdf809..34087f19 100644 --- a/tsMuxer/tsMuxer.cpp +++ b/tsMuxer/tsMuxer.cpp @@ -519,7 +519,7 @@ void TSMuxer::processM2TSPCR(const int64_t pcrVal, const int64_t pcrGAP) const int m2tsFrameCnt = calcM2tsFrameCnt(); const int64_t hiResPCR = pcrVal * 300 - pcrGAP; const uint64_t pcrValDif = hiResPCR - m_prevM2TSPCR; // m2ts pcr clock based on full 27Mhz counter - const double pcrIncPerFrame = static_cast(pcrValDif + 0.1) / static_cast(m2tsFrameCnt); + const double pcrIncPerFrame = (pcrValDif + 0.1) / static_cast(m2tsFrameCnt); auto curM2TSPCR = static_cast(m_prevM2TSPCR); uint8_t* curPos; @@ -1418,7 +1418,7 @@ void TSMuxer::setSubMode(AbstractMuxer* mainMuxer, const bool flushInterleavedBl void TSMuxer::joinToMasterFile() { m_isExternalFile = true; - m_muxFile = dynamic_cast(m_sublingMuxer)->getDstFile(); + m_muxFile = m_sublingMuxer->getDstFile(); } void TSMuxer::setMasterMode(AbstractMuxer* subMuxer, const bool flushInterleavedBlock) diff --git a/tsMuxer/vc1Parser.cpp b/tsMuxer/vc1Parser.cpp index b3551eb0..19b20d7b 100644 --- a/tsMuxer/vc1Parser.cpp +++ b/tsMuxer/vc1Parser.cpp @@ -34,12 +34,12 @@ static inline int decode012(BitStreamReader& bitReader) void VC1Unit::updateBits(const int bitOffset, const int bitLen, const int value) const { - uint8_t* ptr = (uint8_t*)bitReader.getBuffer() + bitOffset / 8; + uint8_t* ptr = bitReader.getBuffer() + bitOffset / 8; BitStreamWriter bitWriter{}; const int byteOffset = bitOffset % 8; bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); - const uint8_t* ptr_end = (uint8_t*)bitReader.getBuffer() + (bitOffset + bitLen) / 8; + const uint8_t* ptr_end = bitReader.getBuffer() + (bitOffset + bitLen) / 8; const int endBitsPostfix = 8 - ((bitOffset + bitLen) % 8); if (byteOffset > 0) diff --git a/tsMuxer/vvc.cpp b/tsMuxer/vvc.cpp index 4ac6fdd5..abc1fbde 100644 --- a/tsMuxer/vvc.cpp +++ b/tsMuxer/vvc.cpp @@ -63,12 +63,12 @@ int VvcUnit::deserialize() void VvcUnit::updateBits(const int bitOffset, const int bitLen, const int value) const { - uint8_t* ptr = (uint8_t*)m_reader.getBuffer() + bitOffset / 8; + uint8_t* ptr = m_reader.getBuffer() + bitOffset / 8; BitStreamWriter bitWriter{}; const int byteOffset = bitOffset % 8; bitWriter.setBuffer(ptr, ptr + (bitLen / 8 + 5)); - const uint8_t* ptr_end = (uint8_t*)m_reader.getBuffer() + (bitOffset + bitLen) / 8; + const uint8_t* ptr_end = m_reader.getBuffer() + (bitOffset + bitLen) / 8; const int endBitsPostfix = 8 - ((bitOffset + bitLen) % 8); if (byteOffset > 0)