From: Steve Lhomme Date: Sat, 15 Oct 2022 08:57:09 +0000 (+0200) Subject: use standard C++ integer types instead of old libebml ones X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a316646229ad2645bc76aa9e723ded84a0feeb63;p=libmatroska use standard C++ integer types instead of old libebml ones --- diff --git a/matroska/FileKax.h b/matroska/FileKax.h index c813f8d..1af9c06 100644 --- a/matroska/FileKax.h +++ b/matroska/FileKax.h @@ -64,23 +64,23 @@ class MATROSKA_DLL_API FileMatroska { ~FileMatroska() = default; #ifdef OLD filepos_t RenderHead(const std::string & aEncoderApp); - uint32 ReadHead(); - uint32 ReadTracks(); - uint32 ReadCodec(); - void Close(const uint32 aTimeLength); + std::uint32_t ReadHead(); + std::uint32_t ReadTracks(); + std::uint32_t ReadCodec(); + void Close(const std::uint32_t aTimeLength); inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);} inline void type_SetAds(const std::string & aStr) {myMainHeader.type_SetAds(aStr);} inline void type_SetSize(const std::string & aStr) {myMainHeader.type_SetSize(aStr);} - inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);} + inline void type_SetSize(std::uint64_t aSize) {myMainHeader.type_SetSize(aSize);} - inline uint8 GetTrackNumber() const { return myTracks.size(); } + inline std::uint8_t GetTrackNumber() const { return myTracks.size(); } void track_SetName(Track * aTrack, const std::string & aName); void track_SetLaced(Track * aTrack, bool bLaced = true); Track * CreateTrack(const track_type aType); - inline Track * GetTrack(const uint8 aTrackNb) const + inline Track * GetTrack(const std::uint8_t aTrackNb) const { if (aTrackNb > myTracks.size()) return NULL; @@ -101,13 +101,13 @@ class MATROSKA_DLL_API FileMatroska { /*! \return wether the frame has been added or not */ - bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize, + bool AddFrame(Track * aTrack, const std::uint32_t aTimecode, const binary *aFrame, const std::uint32_t aFrameSize, bool aKeyFrame = true, bool aBFrame = false); /*! \return wether the frame has been read or not */ - bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize, + bool ReadFrame(Track * & aTrack, std::uint32_t & aTimecode, const binary * & aFrame, std::uint32_t & aFrameSize, bool & aKeyFrame, bool & aBFrame); /* @@ -115,33 +115,33 @@ class MATROSKA_DLL_API FileMatroska { */ void Flush(); - void SetMaxClusterSize(const uint32 value); - void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;} + void SetMaxClusterSize(const std::uint32_t value); + void SetMinClusterSize(const std::uint32_t value) {myMinClusterSize = value;} protected: MainHeader myMainHeader; std::vector myTracks; - std::vector mySelectedTracks; + std::vector mySelectedTracks; // Track *findTrack(Track * aTrack) const; Cluster myCurrWriteCluster; /// \todo merge with the write one ? - uint32 myReadBlockNumber; + std::uint32_t myReadBlockNumber; Cluster myCurrReadCluster; binary * myCurrReadBlock; ///< The buffer containing the current read block - uint32 myCurrReadBlockSize; ///< The size of the buffer containing the current read block - uint8 myCurrReadBlockTrack; ///< The track number of the current track to read + std::uint32_t myCurrReadBlockSize; ///< The size of the buffer containing the current read block + std::uint8_t myCurrReadBlockTrack; ///< The track number of the current track to read - uint32 myMaxClusterSize; - uint32 myMinClusterSize; + std::uint32_t myMaxClusterSize; + std::uint32_t myMinClusterSize; StreamInfo myStreamInfo; CodecHeader myCodecHeader; inline bool IsMyTrack(const Track * aTrack) const; - inline bool IsReadingTrack(const uint8 aTrackNum) const; + inline bool IsReadingTrack(const std::uint8_t aTrackNum) const; #endif // OLD IOCallback & myFile; diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index d272bfd..9b8acc9 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -55,13 +55,13 @@ class KaxBlockBlob; class MATROSKA_DLL_API DataBuffer { protected: binary *myBuffer{nullptr}; - uint32 mySize; + std::uint32_t mySize; bool bValidValue{true}; bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer bool bInternalBuffer; public: - DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false) + DataBuffer(binary * aBuffer, std::uint32_t aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false) :mySize(aSize) ,myFreeBuffer(aFreeBuffer) ,bInternalBuffer(_bInternalBuffer) @@ -80,9 +80,9 @@ class MATROSKA_DLL_API DataBuffer { virtual ~DataBuffer() = default; virtual binary * Buffer() {assert(bValidValue); return myBuffer;} - virtual uint32 & Size() {return mySize;}; + virtual std::uint32_t & Size() {return mySize;}; virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;} - virtual uint32 Size() const {return mySize;}; + virtual std::uint32_t Size() const {return mySize;}; bool FreeBuffer(const DataBuffer & aBuffer) { bool bResult = true; if (myBuffer && bValidValue) { @@ -102,7 +102,7 @@ class MATROSKA_DLL_API DataBuffer { class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { public: - SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer) + SimpleDataBuffer(binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer) :DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer) ,Offset(aOffset) ,BaseBuffer(aBuffer) @@ -112,7 +112,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { DataBuffer * Clone() override {return new SimpleDataBuffer(*this);} protected: - uint32 Offset; + std::uint32_t Offset; binary * BaseBuffer; static bool myFreeBuffer(const DataBuffer & aBuffer) @@ -131,7 +131,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { * / class MATROSKA_DLL_API NotSoSimpleDataBuffer : public SimpleDataBuffer { public: - NotSoSimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset) + NotSoSimpleDataBuffer(binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset) :SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0) { memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset); @@ -146,17 +146,17 @@ DECLARE_MKX_MASTER(KaxBlockGroup) /*! \brief Addition of a frame without references */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO); /*! \brief Addition of a frame with a backward reference (P frame) */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO); /*! \brief Addition of a frame with a backward+forward reference (B frame) */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO); - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing = LACING_AUTO); void SetParent(KaxCluster & aParentCluster); @@ -167,21 +167,21 @@ DECLARE_MKX_MASTER(KaxBlockGroup) /*! \brief Set the duration of the contained frame(s) (for the total number of frames) */ - void SetBlockDuration(uint64 TimeLength); - bool GetBlockDuration(uint64 &TheTimecode) const; + void SetBlockDuration(std::uint64_t TimeLength); + bool GetBlockDuration(std::uint64_t &TheTimecode) const; /*! \return the global timecode of this Block (not just the delta to the Cluster) */ - uint64 GlobalTimecode() const; - uint64 GlobalTimecodeScale() const { + std::uint64_t GlobalTimecode() const; + std::uint64_t GlobalTimecodeScale() const { assert(ParentTrack); return ParentTrack->GlobalTimecodeScale(); } - uint16 TrackNumber() const; + std::uint16_t TrackNumber() const; - uint64 ClusterPosition() const; + std::uint64_t ClusterPosition() const; /*! \return the number of references to other frames @@ -211,11 +211,11 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { ~KaxInternalBlock() override; bool ValidateSize() const override; - uint16 TrackNum() const {return TrackNumber;} + std::uint16_t TrackNum() const {return TrackNumber;} /*! \todo !!!! This method needs to be changes ! */ - uint64 GlobalTimecode() const {return Timecode;} + std::uint64_t GlobalTimecode() const {return Timecode;} /*! \note override this function to generate the Data/Size on the fly, unlike the usual binary elements @@ -227,12 +227,12 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { \brief Only read the head of the Block (not internal data) \note convenient when you are parsing the file quickly */ - uint64 ReadInternalHead(IOCallback & input); + std::uint64_t ReadInternalHead(IOCallback & input); unsigned int NumberFrames() const { return SizeList.size();} DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];} - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false); /*! \brief release all the frames of all Blocks @@ -251,35 +251,35 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { \return the position in the stream for a given frame \note return -1 if the position doesn't exist */ - int64 GetDataPosition(size_t FrameNumber = 0); + std::int64_t GetDataPosition(size_t FrameNumber = 0); /*! \param FrameNumber 0 for the first frame \return the size of a given frame \note return -1 if the position doesn't exist */ - int64 GetFrameSize(size_t FrameNumber = 0); + std::int64_t GetFrameSize(size_t FrameNumber = 0); bool IsInvisible() const { return mInvisible; } - uint64 ClusterPosition() const; + std::uint64_t ClusterPosition() const; /*! * \return Get the timestamp as written in the Block (not scaled). * \since LIBMATROSKA_VERSION >= 0x010700 */ - int16 GetRelativeTimestamp() const { return LocalTimecode; } + std::int16_t GetRelativeTimestamp() const { return LocalTimecode; } protected: std::vector myBuffers; - std::vector SizeList; - uint64 Timecode; // temporary timecode of the first frame, non scaled - int16 LocalTimecode; + std::vector SizeList; + std::uint64_t Timecode; // temporary timecode of the first frame, non scaled + std::int16_t LocalTimecode; bool bLocalTimecodeUsed{false}; - uint16 TrackNumber; + std::uint16_t TrackNumber; LacingType mLacing{LACING_AUTO}; bool mInvisible{false}; - uint64 FirstFrameLocation; + std::uint64_t FirstFrameLocation; KaxCluster *ParentCluster{nullptr}; bool bIsSimple; @@ -335,10 +335,10 @@ public: void SetBlockGroup( KaxBlockGroup &BlockRef ); - void SetBlockDuration(uint64 TimeLength); + void SetBlockDuration(std::uint64_t TimeLength); void SetParent(KaxCluster & aParentCluster); - bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = nullptr, const KaxBlockBlob * ForwBlock = nullptr); + bool AddFrameAuto(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = nullptr, const KaxBlockBlob * ForwBlock = nullptr); bool IsSimpleBlock() const {return bUseSimpleBlock;} @@ -369,8 +369,8 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual) filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override; protected: - uint64 Timecode; // temporary timecode of the first frame if there are more than one - uint16 TrackNumber; + std::uint64_t Timecode; // temporary timecode of the first frame if there are more than one + std::uint16_t TrackNumber; binary DataBlock[5]; const KaxCluster * ParentCluster{nullptr}; diff --git a/matroska/KaxBlockData.h b/matroska/KaxBlockData.h index 405aac3..404bca3 100644 --- a/matroska/KaxBlockData.h +++ b/matroska/KaxBlockData.h @@ -59,7 +59,7 @@ DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock) void SetReferencedBlock(const KaxBlockBlob * aRefdBlock); void SetReferencedBlock(const KaxBlockGroup & aRefdBlock); void SetParentBlock(const KaxBlockGroup & aParentBlock) {ParentBlock = &aParentBlock;} - void SetReferencedTimecode(int64 refTimecode) {*static_cast(this) = refTimecode; bTimecodeSet = true;}; + void SetReferencedTimecode(std::int64_t refTimecode) {*static_cast(this) = refTimecode; bTimecodeSet = true;}; protected: const KaxBlockBlob * RefdBlock{nullptr}; diff --git a/matroska/KaxCluster.h b/matroska/KaxCluster.h index aeb300e..d8270aa 100644 --- a/matroska/KaxCluster.h +++ b/matroska/KaxCluster.h @@ -55,20 +55,20 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) \param timecode the timecode is expressed in nanoseconds, relative to the beggining of the Segment */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO); /*! \brief Addition of a frame with a backward reference (P frame) \param timecode the timecode is expressed in nanoseconds, relative to the beggining of the Segment */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO); /*! \brief Addition of a frame with a backward+forward reference (B frame) \param timecode the timecode is expressed in nanoseconds, relative to the beggining of the Segment */ - bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO); + bool AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO); /*! \brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries @@ -78,7 +78,7 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) /*! \return the global timecode of this Cluster */ - uint64 GlobalTimecode() const; + std::uint64_t GlobalTimecode() const; KaxBlockGroup & GetNewBlock(); @@ -91,11 +91,11 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) /*! \brief return the position offset compared to the beggining of the Segment */ - uint64 GetPosition() const; + std::uint64_t GetPosition() const; void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;} - void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) { + void SetPreviousTimecode(std::uint64_t aPreviousTimecode, std::int64_t aTimecodeScale) { bPreviousTimecodeIsSet = true; PreviousTimecode = aPreviousTimecode; SetGlobalTimecodeScale(aTimecodeScale); @@ -105,21 +105,21 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) \note dirty hack to get the mandatory data back after reading \todo there should be a better way to get mandatory data */ - void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) { + void InitTimecode(std::uint64_t aTimecode, std::int64_t aTimecodeScale) { SetGlobalTimecodeScale(aTimecodeScale); MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale; bFirstFrameInside = bPreviousTimecodeIsSet = true; } - int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const; + std::int16_t GetBlockLocalTimecode(std::uint64_t GlobalTimecode) const; - uint64 GetBlockGlobalTimecode(int16 LocalTimecode); + std::uint64_t GetBlockGlobalTimecode(std::int16_t LocalTimecode); - void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { + void SetGlobalTimecodeScale(std::uint64_t aGlobalTimecodeScale) { TimecodeScale = aGlobalTimecodeScale; bTimecodeScaleIsSet = true; } - uint64 GlobalTimecodeScale() const { + std::uint64_t GlobalTimecodeScale() const { assert(bTimecodeScaleIsSet); return TimecodeScale; } @@ -140,8 +140,8 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) KaxBlockGroup * currentNewBlock{nullptr}; const KaxSegment * ParentSegment{nullptr}; - uint64 MinTimecode, MaxTimecode, PreviousTimecode; - int64 TimecodeScale; + std::uint64_t MinTimecode, MaxTimecode, PreviousTimecode; + std::int64_t TimecodeScale; bool bFirstFrameInside{false}; // used to speed research bool bPreviousTimecodeIsSet{false}; @@ -151,7 +151,7 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) /*! \note method used internally */ - bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing); + bool AddFrameInternal(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing); }; } // namespace libmatroska diff --git a/matroska/KaxCues.h b/matroska/KaxCues.h index 25ead53..4e7a6d6 100644 --- a/matroska/KaxCues.h +++ b/matroska/KaxCues.h @@ -68,14 +68,14 @@ DECLARE_MKX_MASTER(KaxCues) return EbmlMaster::Render(output, bSaveDefault); } - uint64 GetTimecodePosition(uint64 aTimecode) const; - const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const; + std::uint64_t GetTimecodePosition(std::uint64_t aTimecode) const; + const KaxCuePoint * GetTimecodePoint(std::uint64_t aTimecode) const; - void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { + void SetGlobalTimecodeScale(std::uint64_t aGlobalTimecodeScale) { mGlobalTimecodeScale = aGlobalTimecodeScale; bGlobalTimecodeScaleIsSet = true; } - uint64 GlobalTimecodeScale() const { + std::uint64_t GlobalTimecodeScale() const { assert(bGlobalTimecodeScaleIsSet); return mGlobalTimecodeScale; } @@ -83,7 +83,7 @@ DECLARE_MKX_MASTER(KaxCues) protected: std::vector myTempReferences; bool bGlobalTimecodeScaleIsSet; - uint64 mGlobalTimecodeScale; + std::uint64_t mGlobalTimecodeScale; }; } // namespace libmatroska diff --git a/matroska/KaxCuesData.h b/matroska/KaxCuesData.h index 38878d4..965c0bf 100644 --- a/matroska/KaxCuesData.h +++ b/matroska/KaxCuesData.h @@ -50,27 +50,27 @@ class KaxSimpleBlock; DECLARE_MKX_MASTER(KaxCuePoint) public: - void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale); - void PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale); - void PositionSet(const KaxSimpleBlock & BlockReference, uint64 GlobalTimecodeScale); - void PositionSet(const KaxInternalBlock & BlockReference, const KaxBlockGroup *BlockGroup, uint64 GlobalTimecodeScale); + void PositionSet(const KaxBlockGroup & BlockReference, std::uint64_t GlobalTimecodeScale); + void PositionSet(const KaxBlockBlob & BlobReference, std::uint64_t GlobalTimecodeScale); + void PositionSet(const KaxSimpleBlock & BlockReference, std::uint64_t GlobalTimecodeScale); + void PositionSet(const KaxInternalBlock & BlockReference, const KaxBlockGroup *BlockGroup, std::uint64_t GlobalTimecodeScale); bool IsSmallerThan(const EbmlElement *Cmp) const override; const KaxCueTrackPositions * GetSeekPosition() const; - bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const; + bool Timecode(std::uint64_t & aTimecode, std::uint64_t GlobalTimecodeScale) const; }; DECLARE_MKX_MASTER(KaxCueTrackPositions) public: - uint64 ClusterPosition() const; - uint16 TrackNumber() const; + std::uint64_t ClusterPosition() const; + std::uint16_t TrackNumber() const; }; DECLARE_MKX_MASTER(KaxCueReference) public: - void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale); - void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale); + void AddReference(const KaxBlockGroup & BlockReferenced, std::uint64_t GlobalTimecodeScale); + void AddReference(const KaxBlockBlob & BlockReferenced, std::uint64_t GlobalTimecodeScale); }; } // namespace libmatroska diff --git a/matroska/KaxSeekHead.h b/matroska/KaxSeekHead.h index 46aac7f..97bc6f4 100644 --- a/matroska/KaxSeekHead.h +++ b/matroska/KaxSeekHead.h @@ -49,7 +49,7 @@ class KaxSegment; DECLARE_MKX_MASTER(KaxSeek) public: - int64 Location() const; + std::int64_t Location() const; bool IsEbmlId(const EbmlId & aId) const; bool IsEbmlId(const KaxSeek & aPoint) const; }; diff --git a/matroska/KaxSegment.h b/matroska/KaxSegment.h index 3384890..bb983de 100644 --- a/matroska/KaxSegment.h +++ b/matroska/KaxSegment.h @@ -48,13 +48,13 @@ DECLARE_MKX_MASTER_CONS(KaxSegment) /*! \brief give the position of the element in the segment */ - uint64 GetRelativePosition(const EbmlElement & Elt) const; - uint64 GetRelativePosition(uint64 aGlobalPosition) const; + std::uint64_t GetRelativePosition(const EbmlElement & Elt) const; + std::uint64_t GetRelativePosition(std::uint64_t aGlobalPosition) const; /*! \brief give the position of the element in the file */ - uint64 GetGlobalPosition(uint64 aRelativePosition) const; + std::uint64_t GetGlobalPosition(std::uint64_t aRelativePosition) const; }; } // namespace libmatroska diff --git a/matroska/KaxTracks.h b/matroska/KaxTracks.h index 9b9ff39..b6b54a0 100644 --- a/matroska/KaxTracks.h +++ b/matroska/KaxTracks.h @@ -56,21 +56,21 @@ DECLARE_MKX_MASTER(KaxTrackEntry) */ inline bool LacingEnabled() const { auto myLacing = static_cast(FindFirstElt(EBML_INFO(KaxTrackFlagLacing))); - return(!myLacing || (static_cast(*myLacing) != 0)); + return(!myLacing || (static_cast(*myLacing) != 0)); } - void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { + void SetGlobalTimecodeScale(std::uint64_t aGlobalTimecodeScale) { mGlobalTimecodeScale = aGlobalTimecodeScale; bGlobalTimecodeScaleIsSet = true; } - uint64 GlobalTimecodeScale() const { + std::uint64_t GlobalTimecodeScale() const { assert(bGlobalTimecodeScaleIsSet); return mGlobalTimecodeScale; } protected: bool bGlobalTimecodeScaleIsSet{false}; - uint64 mGlobalTimecodeScale; + std::uint64_t mGlobalTimecodeScale; }; } // namespace libmatroska diff --git a/matroska/c/libmatroska.h b/matroska/c/libmatroska.h index 53eb668..961e97c 100644 --- a/matroska/c/libmatroska.h +++ b/matroska/c/libmatroska.h @@ -92,16 +92,16 @@ matroska_id matroska_open_url(c_string string); */ void MATROSKA_EXPORT matroska_close(matroska_id id); -void MATROSKA_EXPORT matroska_end(matroska_id id, uint32 totaltime); +void MATROSKA_EXPORT matroska_end(matroska_id id, std::uint32_t totaltime); matroska_track MATROSKA_EXPORT matroska_create_track(matroska_id id, enum track_type type); void MATROSKA_EXPORT matroska_read_head(matroska_id id); void MATROSKA_EXPORT matroska_read_tracks(matroska_id id); -uint8 MATROSKA_EXPORT matroska_get_number_track(matroska_id id); +std::uint8_t MATROSKA_EXPORT matroska_get_number_track(matroska_id id); -matroska_track MATROSKA_EXPORT matroska_get_track(matroska_id id, uint8 track_index); +matroska_track MATROSKA_EXPORT matroska_get_track(matroska_id id, std::uint8_t track_index); void MATROSKA_EXPORT matroska_get_track_info(matroska_id id, matroska_track track, track_info * infos); diff --git a/matroska/c/libmatroska_t.h b/matroska/c/libmatroska_t.h index f6370c9..4177a61 100644 --- a/matroska/c/libmatroska_t.h +++ b/matroska/c/libmatroska_t.h @@ -36,7 +36,7 @@ \brief Misc type definitions for the C API of libmatroska \note These types should be compiler/language independant (just platform dependant) - \todo recover the sized types (uint16, int32, etc) here too (or maybe here only) + \todo recover the sized types (std::uint16_t, std::int32_t, etc) here too (or maybe here only) */ #ifndef _LIBMATROSKA_T_H_INCLUDED_ diff --git a/src/FileKax.cpp b/src/FileKax.cpp index 3375366..de14d26 100644 --- a/src/FileKax.cpp +++ b/src/FileKax.cpp @@ -79,13 +79,13 @@ FileMatroska::FileMatroska(IOCallback & output) } */ #ifdef OLD -void FileMatroska::SetMaxClusterSize(const uint32 value) +void FileMatroska::SetMaxClusterSize(const std::uint32_t value) { myMaxClusterSize = value; myCurrWriteCluster.setMaxSize(value); } -void FileMatroska::Close(const uint32 aTimeLength) +void FileMatroska::Close(const std::uint32_t aTimeLength) { Flush(); @@ -97,7 +97,7 @@ void FileMatroska::Close(const uint32 aTimeLength) myFile.setFilePointer(0,seek_beginning); // get the Track-entry size - uint32 track_entries_size = 0; + std::uint32_t track_entries_size = 0; for (const auto& myTrack : myTracks) { track_entries_size += myTrack->default_size(); } @@ -117,7 +117,7 @@ void FileMatroska::Close(const uint32 aTimeLength) filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp) { try { - uint32 track_entries_size = 0; + std::uint32_t track_entries_size = 0; for (const auto& myTrack : myTracks) { track_entries_size += myTrack->default_size(); } @@ -189,7 +189,7 @@ void FileMatroska::track_SetLaced(Track * aTrack, bool bLaced) } } -bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize, +bool FileMatroska::AddFrame(Track * aTrack, const std::uint32_t aTimecode, const binary *aFrame, const std::uint32_t aFrameSize, bool aKeyFrame, bool aBFrame) { try { @@ -200,7 +200,7 @@ bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame)) { while (!aTrack->SerialiseBlock(myCurrWriteCluster)) { /// \todo handle errors - uint32 aNbBlock; + std::uint32_t aNbBlock; myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock); myStreamInfo.NumberBlock += aNbBlock; myCurrWriteCluster.Flush(); @@ -217,15 +217,15 @@ bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary void FileMatroska::Flush() { - uint32 aNbBlock; + std::uint32_t aNbBlock; myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile,aNbBlock); myStreamInfo.NumberBlock += aNbBlock; } -uint32 FileMatroska::ReadHead() +std::uint32_t FileMatroska::ReadHead() { try { - uint32 result = myMainHeader.Read(myFile, myStreamInfo); + std::uint32_t result = myMainHeader.Read(myFile, myStreamInfo); return result; } @@ -234,18 +234,18 @@ uint32 FileMatroska::ReadHead() } } -uint32 FileMatroska::ReadTracks() +std::uint32_t FileMatroska::ReadTracks() { try { - uint32 result = 0; + std::uint32_t result = 0; // seek to the start of the Track Entries myFile.setFilePointer(myStreamInfo.TrackEntryPosition); // get the number of Track Entries - uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize; + std::uint8_t TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize; // read all the Track Entries myTracks.clear(); - for (uint8 TrackIdx = 0; TrackIdx= aTrackNumber; }) } @@ -351,7 +351,7 @@ void FileMatroska::Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aT /*! \todo exit when there is no Block left */ -bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize, +bool FileMatroska::ReadFrame(Track * & aTrack, std::uint32_t & aTimecode, const binary * & aFrame, std::uint32_t & aFrameSize, bool & aKeyFrame, bool & aBFrame) { if (myCurrReadBlockTrack == 0) { diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 33f1829..54523f1 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -107,13 +107,13 @@ KaxBlockGroup::KaxBlockGroup(EBML_EXTRA_DEF) \todo hardcoded limit of the number of frames in a lace should be a parameter \return true if more frames can be added to this Block */ -bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, bool invisible) +bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing, bool invisible) { SetValueIsSet(); if (myBuffers.empty()) { // first frame Timecode = timecode; - TrackNumber = static_cast(track.TrackNumber()); + TrackNumber = static_cast(track.TrackNumber()); mInvisible = invisible; mLacing = lacing; } @@ -151,7 +151,7 @@ LacingType KaxInternalBlock::GetBestLacingType() const { } EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize()); for (i = 1; i < static_cast(myBuffers.size()) - 1; i++) - EbmlLacingSize += CodedSizeLengthSigned(static_cast(myBuffers[i]->Size()) - static_cast(myBuffers[i - 1]->Size()), 0); + EbmlLacingSize += CodedSizeLengthSigned(static_cast(myBuffers[i]->Size()) - static_cast(myBuffers[i - 1]->Size()), 0); if (SameSize) return LACING_FIXED; if (XiphLacingSize < EbmlLacingSize) @@ -190,7 +190,7 @@ filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRe case LACING_EBML: SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize())); for (i=1; iSize() + CodedSizeLengthSigned(static_cast(myBuffers[i]->Size()) - static_cast(myBuffers[i-1]->Size()), 0)); + SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(static_cast(myBuffers[i]->Size()) - static_cast(myBuffers[i-1]->Size()), 0)); } break; case LACING_FIXED: @@ -250,7 +250,7 @@ filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRen } assert(ParentCluster); - const int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode); + const std::int16_t ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode); const auto b16 = big_int16(ActualTimecode); b16.Fill(cursor); cursor += 2; @@ -294,7 +294,7 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender } assert(ParentCluster); - const int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode); + const std::int16_t ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode); const auto b16 = big_int16(ActualTimecode); b16.Fill(cursor); cursor += 2; @@ -345,7 +345,7 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender // set the size of each member in the lace for (i=0; iSize(); + std::uint16_t tmpSize = myBuffers[i]->Size(); while (tmpSize >= 0xFF) { output.writeFully(&tmpValue, 1); SetSize_(GetSize() + 1); @@ -361,7 +361,7 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender tmpValue = myBuffers.size()-1; output.writeFully(&tmpValue, 1); { - int64 _Size; + std::int64_t _Size; int _CodedSize; binary _FinalHead[8]; // 64 bits max coded size @@ -376,7 +376,7 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender // set the size of each member in the lace for (i=1; i(myBuffers[i]->Size()) - static_cast(myBuffers[i-1]->Size()); + _Size = static_cast(myBuffers[i]->Size()) - static_cast(myBuffers[i-1]->Size()); _CodedSize = CodedSizeLengthSigned(_Size, 0); CodedValueLengthSigned(_Size, _CodedSize, _FinalHead); output.writeFully(_FinalHead, _CodedSize); @@ -404,10 +404,10 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender return GetSize(); } -uint64 KaxInternalBlock::ReadInternalHead(IOCallback & input) +std::uint64_t KaxInternalBlock::ReadInternalHead(IOCallback & input) { binary Buffer[5], *cursor = Buffer; - uint64 Result = input.read(cursor, 4); + std::uint64_t Result = input.read(cursor, 4); if (Result != 4) return Result; @@ -430,7 +430,7 @@ uint64 KaxInternalBlock::ReadInternalHead(IOCallback & input) big_int16 b16; b16.Eval(cursor); assert(ParentCluster); - Timecode = ParentCluster->GetBlockGlobalTimecode(static_cast(b16)); + Timecode = ParentCluster->GetBlockGlobalTimecode(static_cast(b16)); bLocalTimecodeUsed = false; cursor += 2; @@ -457,7 +457,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) binary *const BufferStart = EbmlBinary::GetBuffer(); SafeReadIOCallback Mem(*this); - uint8 BlockHeadSize = 4; + std::uint8_t BlockHeadSize = 4; // update internal values TrackNumber = Mem.GetUInt8(); @@ -474,10 +474,10 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) TrackNumber &= 0x7F; } - LocalTimecode = static_cast(Mem.GetUInt16BE()); + LocalTimecode = static_cast(Mem.GetUInt16BE()); bLocalTimecodeUsed = true; - const uint8 Flags = Mem.GetUInt8(); + const std::uint8_t Flags = Mem.GetUInt8(); if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) { bIsKeyframe = (Flags & 0x80) != 0; bIsDiscardable = (Flags & 0x01) != 0; @@ -494,13 +494,13 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) SizeList[0] = GetSize() - BlockHeadSize; } else { // read the number of frames in the lace - uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame - const uint8 FrameNum = Mem.GetUInt8(); // number of frames in the lace - 1 + std::uint32_t LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame + const std::uint8_t FrameNum = Mem.GetUInt8(); // number of frames in the lace - 1 // read the list of frame sizes - uint8 Index; - int32 FrameSize; - uint32 SizeRead; - uint64 SizeUnknown; + std::uint8_t Index; + std::int32_t FrameSize; + std::uint32_t SizeRead; + std::uint64_t SizeUnknown; SizeList.resize(FrameNum + 1); @@ -509,7 +509,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) for (Index=0; Index(FrameSize + SizeRead) > LastBufferSize)) + if (!FrameSize || (static_cast(FrameSize + SizeRead) > LastBufferSize)) throw SafeReadIOCallback::EndOfStreamX(SizeRead); SizeList[0] = FrameSize; Mem.Skip(SizeRead); @@ -533,7 +533,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) // get the size of the frame SizeRead = LastBufferSize; FrameSize += ReadCodedSizeSignedValue(BufferStart + Mem.GetPosition(), SizeRead, SizeUnknown); - if (!FrameSize || (static_cast(FrameSize + SizeRead) > LastBufferSize)) + if (!FrameSize || (static_cast(FrameSize + SizeRead) > LastBufferSize)) throw SafeReadIOCallback::EndOfStreamX(SizeRead); SizeList[Index] = FrameSize; Mem.Skip(SizeRead); @@ -582,7 +582,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) throw SafeReadIOCallback::EndOfStreamX(0); binary *cursor = _TempHead; binary *_tmpBuf; - uint8 BlockHeadSize = 4; + std::uint8_t BlockHeadSize = 4; // update internal values TrackNumber = *cursor++; @@ -601,7 +601,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) big_int16 b16; b16.Eval(cursor); - LocalTimecode = static_cast(b16); + LocalTimecode = static_cast(b16); bLocalTimecodeUsed = true; cursor += 2; @@ -622,14 +622,14 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) // put all Frames in the list if (mLacing != LACING_NONE) { // read the number of frames in the lace - const uint32 TotalLacedSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame - uint32 LastBufferSize = TotalLacedSize; - const uint8 FrameNum = _TempHead[0]; // number of frames in the lace - 1 + const std::uint32_t TotalLacedSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame + std::uint32_t LastBufferSize = TotalLacedSize; + const std::uint8_t FrameNum = _TempHead[0]; // number of frames in the lace - 1 // read the list of frame sizes - uint8 Index; - uint32 FrameSize; - uint32 SizeRead; - uint64 SizeUnknown; + std::uint8_t Index; + std::uint32_t FrameSize; + std::uint32_t SizeRead; + std::uint64_t SizeUnknown; SizeList.resize(FrameNum + 1); @@ -640,7 +640,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) FrameSize = 0; do { Result += input.read(_TempHead, 1); - FrameSize += static_cast(_TempHead[0]); + FrameSize += static_cast(_TempHead[0]); if (FrameSize > TotalLacedSize) throw SafeReadIOCallback::EndOfStreamX(0); LastBufferSize--; @@ -718,7 +718,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) return Result; } -bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing) +bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing) { auto & theBlock = GetChild(*this); assert(ParentCluster); @@ -727,7 +727,7 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB return theBlock.AddFrame(track, timecode, buffer, lacing); } -bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing) +bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing) { // assert(past_timecode < 0); @@ -744,7 +744,7 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB return bRes; } -bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing) +bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing) { // assert(past_timecode < 0); @@ -767,7 +767,7 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB return bRes; } -bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing) +bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing) { auto & theBlock = GetChild(*this); assert(ParentCluster); @@ -793,26 +793,26 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB /*! \todo we may cache the reference to the timecode block */ -uint64 KaxBlockGroup::GlobalTimecode() const +std::uint64_t KaxBlockGroup::GlobalTimecode() const { assert(ParentCluster); // impossible otherwise auto MyBlock = static_cast(this->FindElt(EBML_INFO(KaxBlock))); return MyBlock->GlobalTimecode(); } -uint16 KaxBlockGroup::TrackNumber() const +std::uint16_t KaxBlockGroup::TrackNumber() const { auto MyBlock = static_cast(this->FindElt(EBML_INFO(KaxBlock))); return MyBlock->TrackNum(); } -uint64 KaxBlockGroup::ClusterPosition() const +std::uint64_t KaxBlockGroup::ClusterPosition() const { assert(ParentCluster); // impossible otherwise return ParentCluster->GetPosition(); } -uint64 KaxInternalBlock::ClusterPosition() const +std::uint64_t KaxInternalBlock::ClusterPosition() const { assert(ParentCluster); // impossible otherwise return ParentCluster->GetPosition(); @@ -862,15 +862,15 @@ void KaxInternalBlock::ReleaseFrames() } } -void KaxBlockGroup::SetBlockDuration(uint64 TimeLength) +void KaxBlockGroup::SetBlockDuration(std::uint64_t TimeLength) { assert(ParentTrack); - const int64 scale = ParentTrack->GlobalTimecodeScale(); + const std::int64_t scale = ParentTrack->GlobalTimecodeScale(); const auto myDuration = static_cast(FindFirstElt(EBML_INFO(KaxBlockDuration), true)); - *(static_cast(myDuration)) = TimeLength / static_cast(scale); + *(static_cast(myDuration)) = TimeLength / static_cast(scale); } -bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const +bool KaxBlockGroup::GetBlockDuration(std::uint64_t &TheTimecode) const { const auto myDuration = static_cast(FindElt(EBML_INFO(KaxBlockDuration))); if (!myDuration) { @@ -878,7 +878,7 @@ bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const } assert(ParentTrack); - TheTimecode = static_cast(*myDuration) * ParentTrack->GlobalTimecodeScale(); + TheTimecode = static_cast(*myDuration) * ParentTrack->GlobalTimecodeScale(); return true; } @@ -906,9 +906,9 @@ void KaxInternalBlock::SetParent(KaxCluster & aParentCluster) } } -int64 KaxInternalBlock::GetDataPosition(size_t FrameNumber) +std::int64_t KaxInternalBlock::GetDataPosition(size_t FrameNumber) { - int64 _Result = -1; + std::int64_t _Result = -1; if (ValueIsSet() && FrameNumber < SizeList.size()) { _Result = FirstFrameLocation; @@ -922,9 +922,9 @@ int64 KaxInternalBlock::GetDataPosition(size_t FrameNumber) return _Result; } -int64 KaxInternalBlock::GetFrameSize(size_t FrameNumber) +std::int64_t KaxInternalBlock::GetFrameSize(size_t FrameNumber) { - int64 _Result = -1; + std::int64_t _Result = -1; if (/*bValueIsSet &&*/ FrameNumber < SizeList.size()) { _Result = SizeList[FrameNumber]; @@ -970,7 +970,7 @@ KaxBlockBlob::operator KaxSimpleBlock &() return *Block.simpleblock; } -bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock) +bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, LacingType lacing, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock) { bool bResult = false; if ((SimpleBlockMode == BLOCK_BLOB_ALWAYS_SIMPLE) || (SimpleBlockMode == BLOCK_BLOB_SIMPLE_AUTO && !PastBlock && !ForwBlock)) { @@ -1005,7 +1005,7 @@ void KaxBlockBlob::SetParent(KaxCluster & aParentCluster) ParentCluster = &aParentCluster; } -void KaxBlockBlob::SetBlockDuration(uint64 TimeLength) +void KaxBlockBlob::SetBlockDuration(std::uint64_t TimeLength) { if (ReplaceSimpleByGroup()) Block.group->SetBlockDuration(TimeLength); diff --git a/src/KaxBlockData.cpp b/src/KaxBlockData.cpp index 0a244ec..7082840 100644 --- a/src/KaxBlockData.cpp +++ b/src/KaxBlockData.cpp @@ -78,7 +78,7 @@ filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender) assert(ParentBlock); const auto &block = static_cast(*RefdBlock); - SetValue(static_cast(block.GlobalTimecode()) - static_cast(ParentBlock->GlobalTimecode()) / static_cast(ParentBlock->GlobalTimecodeScale())); + SetValue(static_cast(block.GlobalTimecode()) - static_cast(ParentBlock->GlobalTimecode()) / static_cast(ParentBlock->GlobalTimecodeScale())); } return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender); } diff --git a/src/KaxCluster.cpp b/src/KaxCluster.cpp index d380b80..b3d8038 100644 --- a/src/KaxCluster.cpp +++ b/src/KaxCluster.cpp @@ -65,7 +65,7 @@ bool KaxCluster::AddBlockBlob(KaxBlockBlob * NewBlob) return true; } -bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing) +bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing) { if (!bFirstFrameInside) { bFirstFrameInside = true; @@ -84,7 +84,7 @@ bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, } // force creation of a new block - if (!currentNewBlock || static_cast(track.TrackNumber()) != static_cast(currentNewBlock->TrackNumber()) || PastBlock || ForwBlock) { + if (!currentNewBlock || static_cast(track.TrackNumber()) != static_cast(currentNewBlock->TrackNumber()) || PastBlock || ForwBlock) { KaxBlockGroup & aNewBlock = GetNewBlock(); MyNewBlock = currentNewBlock = &aNewBlock; } @@ -116,19 +116,19 @@ bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, return false; } -bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing) +bool KaxCluster::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing) { assert(Blobs.empty()); // mutually exclusive for the moment return AddFrameInternal(track, timecode, buffer, MyNewBlock, nullptr, nullptr, lacing); } -bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing) +bool KaxCluster::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing) { assert(Blobs.empty()); // mutually exclusive for the moment return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, nullptr, lacing); } -bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing) +bool KaxCluster::AddFrame(const KaxTrackEntry & track, std::uint64_t timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing) { assert(Blobs.empty()); // mutually exclusive for the moment return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, &ForwBlock, lacing); @@ -156,7 +156,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS for (const auto& Trk : *MyTracks) { if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) { auto entry = static_cast(Trk); - auto tracknum = static_cast(entry->TrackNumber()); + auto tracknum = static_cast(entry->TrackNumber()); auto track = std::find_if(ElementList.begin(), ElementList.end(), [=](EbmlElement *element) { return EbmlId(*element) == EBML_ID(KaxBlockGroup) && static_cast(element)->TrackNumber() == tracknum; }); // the track wasn't found in this cluster @@ -194,7 +194,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS for (const auto& Trk : *MyTracks) { if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) { auto entry = static_cast(Trk); - auto tracknum = static_cast(entry->TrackNumber()); + auto tracknum = static_cast(entry->TrackNumber()); for (Index = 0; Index(*Blobs[Index]).TrackNum() == tracknum) break; // this track is used @@ -225,10 +225,10 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS /*! \todo automatically choose valid timecode for the Cluster based on the previous cluster timecode (must be incremental) */ -uint64 KaxCluster::GlobalTimecode() const +std::uint64_t KaxCluster::GlobalTimecode() const { assert(bPreviousTimecodeIsSet); - uint64 result = MinTimecode; + std::uint64_t result = MinTimecode; if (result < PreviousTimecode) result = PreviousTimecode + 1; @@ -240,23 +240,23 @@ uint64 KaxCluster::GlobalTimecode() const \brief retrieve the relative \todo !!! We need a way to know the TimecodeScale */ -int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const +std::int16_t KaxCluster::GetBlockLocalTimecode(std::uint64_t aGlobalTimecode) const { - const int64 TimecodeDelay = (static_cast(aGlobalTimecode) - static_cast(GlobalTimecode())) / static_cast(GlobalTimecodeScale()); - assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF)); - return static_cast(TimecodeDelay); + const std::int64_t TimecodeDelay = (static_cast(aGlobalTimecode) - static_cast(GlobalTimecode())) / static_cast(GlobalTimecodeScale()); + assert(TimecodeDelay >= std::int16_t(0x8000) && TimecodeDelay <= std::int16_t(0x7FFF)); + return static_cast(TimecodeDelay); } -uint64 KaxCluster::GetBlockGlobalTimecode(int16 LocalTimecode) +std::uint64_t KaxCluster::GetBlockGlobalTimecode(std::int16_t LocalTimecode) { if (!bFirstFrameInside) { auto Timecode = static_cast(this->FindElt(EBML_INFO(KaxClusterTimecode))); assert (bFirstFrameInside); // use the InitTimecode() hack for now - MinTimecode = MaxTimecode = PreviousTimecode = static_cast(*static_cast(Timecode)); + MinTimecode = MaxTimecode = PreviousTimecode = static_cast(*static_cast(Timecode)); bFirstFrameInside = true; bPreviousTimecodeIsSet = true; } - return static_cast(LocalTimecode * GlobalTimecodeScale()) + GlobalTimecode(); + return static_cast(LocalTimecode * GlobalTimecodeScale()) + GlobalTimecode(); } KaxBlockGroup & KaxCluster::GetNewBlock() @@ -275,7 +275,7 @@ void KaxCluster::ReleaseFrames() } } -uint64 KaxCluster::GetPosition() const +std::uint64_t KaxCluster::GetPosition() const { assert(ParentSegment); return ParentSegment->GetRelativePosition(*this); diff --git a/src/KaxCues.cpp b/src/KaxCues.cpp index e58f61c..3af6ecc 100644 --- a/src/KaxCues.cpp +++ b/src/KaxCues.cpp @@ -109,12 +109,12 @@ void KaxCues::PositionSet(const KaxBlockGroup & BlockRef) /*! \warning Assume that the list has been sorted (Sort()) */ -const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const +const KaxCuePoint * KaxCues::GetTimecodePoint(std::uint64_t aTimecode) const { - const uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale(); + const std::uint64_t TimecodeToLocate = aTimecode / GlobalTimecodeScale(); const KaxCuePoint * aPointPrev = nullptr; - uint64 aPrevTime = 0; - uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF); + std::uint64_t aPrevTime = 0; + std::uint64_t aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF); for (const auto& e : *this) { if (EbmlId(*e) == EBML_ID(KaxCuePoint)) { @@ -122,7 +122,7 @@ const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const // check the tile auto aTime = static_cast(tmp->FindFirstElt(EBML_INFO(KaxCueTime))); if (aTime) { - auto _Time = static_cast(*aTime); + auto _Time = static_cast(*aTime); if (_Time > aPrevTime && _Time < TimecodeToLocate) { aPrevTime = _Time; aPointPrev = tmp; @@ -137,7 +137,7 @@ const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const return aPointPrev; } -uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const +std::uint64_t KaxCues::GetTimecodePosition(std::uint64_t aTimecode) const { const auto aPoint = GetTimecodePoint(aTimecode); if (!aPoint) diff --git a/src/KaxCuesData.cpp b/src/KaxCuesData.cpp index 2cb252b..7d0fe25 100644 --- a/src/KaxCuesData.cpp +++ b/src/KaxCuesData.cpp @@ -47,7 +47,7 @@ namespace libmatroska { \todo handle codec state checking \todo remove duplicate references (reference to 2 frames that each reference the same frame) */ -void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale) +void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, std::uint64_t GlobalTimecodeScale) { // fill me auto & NewTime = GetChild(*this); @@ -77,7 +77,7 @@ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 Globa SetValueIsSet(); } -void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale) +void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, std::uint64_t GlobalTimecodeScale) { const auto &BlockReference = static_cast(BlobReference); const KaxBlockGroup *BlockGroupPointer = nullptr; @@ -89,12 +89,12 @@ void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalT PositionSet(BlockReference, BlockGroupPointer, GlobalTimecodeScale); } -void KaxCuePoint::PositionSet(const KaxSimpleBlock & BlockReference, uint64 GlobalTimecodeScale) +void KaxCuePoint::PositionSet(const KaxSimpleBlock & BlockReference, std::uint64_t GlobalTimecodeScale) { PositionSet(BlockReference, nullptr, GlobalTimecodeScale); } -void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const KaxBlockGroup *BlockGroup, uint64 GlobalTimecodeScale) +void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const KaxBlockGroup *BlockGroup, std::uint64_t GlobalTimecodeScale) { // fill me auto & NewTime = GetChild(*this); @@ -132,7 +132,7 @@ void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const Kax /*! \todo handle codec state checking */ -void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale) +void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, std::uint64_t GlobalTimecodeScale) { const auto& theBlock = static_cast(BlockReference); auto & NewTime = GetChild(*this); @@ -192,12 +192,12 @@ bool KaxCuePoint::IsSmallerThan(const EbmlElement * Cmp) const return false; } -bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const +bool KaxCuePoint::Timecode(std::uint64_t & aTimecode, std::uint64_t GlobalTimecodeScale) const { const auto aTime = static_cast(FindFirstElt(EBML_INFO(KaxCueTime))); if (!aTime) return false; - aTimecode = static_cast(*aTime) * GlobalTimecodeScale; + aTimecode = static_cast(*aTime) * GlobalTimecodeScale; return true; } @@ -207,13 +207,13 @@ bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const { const KaxCueTrackPositions * result = nullptr; - uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF); + std::uint64_t aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF); // find the position of the "earlier" Cluster auto aPoss = static_cast(FindFirstElt(EBML_INFO(KaxCueTrackPositions))); while (aPoss) { auto aPos = static_cast(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition))); - if (aPos && static_cast(*aPos) < aPosition) { - aPosition = static_cast(*aPos); + if (aPos && static_cast(*aPos) < aPosition) { + aPosition = static_cast(*aPos); result = aPoss; } @@ -222,22 +222,22 @@ const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const return result; } -uint64 KaxCueTrackPositions::ClusterPosition() const +std::uint64_t KaxCueTrackPositions::ClusterPosition() const { const auto aPos = static_cast(FindFirstElt(EBML_INFO(KaxCueClusterPosition))); if (!aPos) return 0; - return static_cast(*aPos); + return static_cast(*aPos); } -uint16 KaxCueTrackPositions::TrackNumber() const +std::uint16_t KaxCueTrackPositions::TrackNumber() const { const auto aTrack = static_cast(FindFirstElt(EBML_INFO(KaxCueTrack))); if (!aTrack) return 0; - return static_cast(*aTrack); + return static_cast(*aTrack); } diff --git a/src/KaxSeekHead.cpp b/src/KaxSeekHead.cpp index 1421205..f1f4830 100644 --- a/src/KaxSeekHead.cpp +++ b/src/KaxSeekHead.cpp @@ -98,12 +98,12 @@ KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const return static_cast(*it2); } -int64 KaxSeek::Location() const +std::int64_t KaxSeek::Location() const { auto aPos = static_cast(FindFirstElt(EBML_INFO(KaxSeekPosition))); if (!aPos) return 0; - return static_cast(*aPos); + return static_cast(*aPos); } bool KaxSeek::IsEbmlId(const EbmlId & aId) const diff --git a/src/KaxSegment.cpp b/src/KaxSegment.cpp index eb3e0c3..ae6720c 100644 --- a/src/KaxSegment.cpp +++ b/src/KaxSegment.cpp @@ -62,17 +62,17 @@ KaxSegment::KaxSegment(const KaxSegment & ElementToClone) } -uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const +std::uint64_t KaxSegment::GetRelativePosition(std::uint64_t aGlobalPosition) const { return aGlobalPosition - GetElementPosition() - HeadSize(); } -uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const +std::uint64_t KaxSegment::GetRelativePosition(const EbmlElement & Elt) const { return GetRelativePosition(Elt.GetElementPosition()); } -uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const +std::uint64_t KaxSegment::GetGlobalPosition(std::uint64_t aRelativePosition) const { return aRelativePosition + GetElementPosition() + HeadSize(); } diff --git a/test/ebml/test0.cpp b/test/ebml/test0.cpp index 7dd9d7a..c0e360b 100644 --- a/test/ebml/test0.cpp +++ b/test/ebml/test0.cpp @@ -261,10 +261,10 @@ int main(void) switch (SemanticList[i].Type) { case EBML_U_INTEGER: - printf(" : %d", uint32(*(EbmlUInteger*)EvaledElementLevel0)); + printf(" : %d", std::uint32_t(*(EbmlUInteger*)EvaledElementLevel0)); break; case EBML_S_INTEGER: - printf(" : %d", int32(*(EbmlSInteger*)EvaledElementLevel0)); + printf(" : %d", std::int32_t(*(EbmlSInteger*)EvaledElementLevel0)); break; case EBML_BINARY: printf(" : binary data, size = %ld", (*(EbmlBinary*)EvaledElementLevel0).GetSize()); diff --git a/test/mux/test6.cpp b/test/mux/test6.cpp index fcc7d5e..a24e40e 100644 --- a/test/mux/test6.cpp +++ b/test/mux/test6.cpp @@ -60,7 +60,7 @@ unsigned int BIN_FILE_SIZE = 15000; unsigned int TXT_FILE_SIZE = 3000; const unsigned int BIN_FRAME_SIZE = 1500; const unsigned int TXT_FRAME_SIZE = 200; -const uint64 TIMECODE_SCALE = 1000000; +const std::uint64_t TIMECODE_SCALE = 1000000; const bool bWriteDefaultValues = false; @@ -93,7 +93,7 @@ int main(int argc, char **argv) KaxSegment FileSegment; // size is unknown and will always be, we can render it right away - uint64 SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues); + std::uint64_t SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues); KaxTracks & MyTracks = GetChild(FileSegment); @@ -200,7 +200,7 @@ int main(int argc, char **argv) KaxVideoPixelWidth & MyTrack2PWidth = GetChild(MyTrack2Video); *(static_cast(&MyTrack2PWidth)) = 320; - uint64 TrackSize = MyTracks.Render(out_file, bWriteDefaultValues); + std::uint64_t TrackSize = MyTracks.Render(out_file, bWriteDefaultValues); KaxTracks * pMyTracks2 = static_cast(MyTracks.Clone()); // KaxTracks * pMyTracks2 = new KaxTracks(MyTracks); @@ -278,7 +278,7 @@ int main(int argc, char **argv) // - write the cluster(s) // - seek back in the file and write the cue entry over the empty element - uint64 ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues); + std::uint64_t ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues); Clust1.ReleaseFrames(); MetaSeek.IndexThis(Clust1, FileSegment); diff --git a/test/mux/test8.cpp b/test/mux/test8.cpp index 132619a..2bba5e1 100644 --- a/test/mux/test8.cpp +++ b/test/mux/test8.cpp @@ -107,7 +107,7 @@ int main(int argc, char **argv) KaxSeekHead *MetaSeek; KaxChapters *Chapters; KaxTags *AllTags; - uint64 TimecodeScale = 1000000; + std::uint64_t TimecodeScale = 1000000; // find the segment to read ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL); @@ -162,7 +162,7 @@ int main(int argc, char **argv) if (EbmlId(*ElementLevel3) == KaxTrackNumber::ClassInfos.GlobalId) { KaxTrackNumber & TrackNum = *static_cast(ElementLevel3); TrackNum.ReadData(aStream.I_O()); - printf("Track # %d\n", uint8(TrackNum)); + printf("Track # %d\n", std::uint8_t(TrackNum)); } // Track type @@ -170,7 +170,7 @@ int main(int argc, char **argv) KaxTrackType & TrackType = *static_cast(ElementLevel3); TrackType.ReadData(aStream.I_O()); printf("Track type : "); - switch(uint8(TrackType)) + switch(std::uint8_t(TrackType)) { case track_audio: printf("Audio"); @@ -252,8 +252,8 @@ int main(int argc, char **argv) if (EbmlId(*ElementLevel2) == KaxTimecodeScale::ClassInfos.GlobalId) { KaxTimecodeScale *TimeScale = static_cast(ElementLevel2); TimeScale->ReadData(aStream.I_O()); - printf("Timecode Scale %d\n", uint32(*TimeScale)); - TimecodeScale = uint64(*TimeScale); + printf("Timecode Scale %d\n", std::uint32_t(*TimeScale)); + TimecodeScale = std::uint64_t(*TimeScale); } else if (EbmlId(*ElementLevel2) == KaxDuration::ClassInfos.GlobalId) { printf("Segment duration\n"); } else if (EbmlId(*ElementLevel2) == KaxDateUTC::ClassInfos.GlobalId) { @@ -298,10 +298,10 @@ int main(int argc, char **argv) printf("\n- Segment Clusters found\n"); SegmentCluster = static_cast(ElementLevel1); // SegmentCluster->ClearElement(); - uint32 ClusterTimecode; + std::uint32_t ClusterTimecode; EbmlCrc32 *pChecksum = NULL; - uint32 SizeInCrc; - uint64 CrcPositionStart = 0; + std::uint32_t SizeInCrc; + std::uint64_t CrcPositionStart = 0; #ifdef MEMORY_READ // read the Cluster in memory and then extract elements from memory SegmentCluster->Read(aStream, KaxCluster::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy); @@ -330,7 +330,7 @@ int main(int argc, char **argv) printf("Cluster timecode found\n"); KaxClusterTimecode & ClusterTime = *static_cast(ElementLevel2); ClusterTime.ReadData(aStream.I_O()); - ClusterTimecode = uint32(ClusterTime); + ClusterTimecode = std::uint32_t(ClusterTime); SegmentCluster->InitTimecode(ClusterTimecode, TimecodeScale); } else if (EbmlId(*ElementLevel2) == KaxBlockGroup::ClassInfos.GlobalId) { printf("Block Group found\n"); @@ -350,11 +350,11 @@ int main(int argc, char **argv) } KaxBlockDuration * BlockDuration = static_cast(aBlockGroup.FindElt(KaxBlockDuration::ClassInfos)); if (BlockDuration != NULL) { - printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(*BlockDuration), uint32(*BlockDuration) * TimecodeScale); + printf(" Block Duration %d scaled ticks : %ld ns\n", std::uint32_t(*BlockDuration), std::uint32_t(*BlockDuration) * TimecodeScale); } KaxReferenceBlock * RefTime = static_cast(aBlockGroup.FindElt(KaxReferenceBlock::ClassInfos)); if (RefTime != NULL) { - printf(" Reference frame at scaled (%d) timecode %ld\n", int32(*RefTime), int32(int64(*RefTime) * TimecodeScale)); + printf(" Reference frame at scaled (%d) timecode %ld\n", std::int32_t(*RefTime), std::int32_t(std::int64_t(*RefTime) * TimecodeScale)); } #else // TEST_BLOCKGROUP_READ // read the data we care about in matroska @@ -392,11 +392,11 @@ int main(int argc, char **argv) } else if (EbmlId(*ElementLevel3) == KaxReferenceBlock::ClassInfos.GlobalId) { KaxReferenceBlock & RefTime = *static_cast(ElementLevel3); RefTime.ReadData(aStream.I_O()); - printf(" Reference frame at scaled (%d) timecode %ld\n", int32(RefTime), int32(int64(RefTime) * TimecodeScale)); + printf(" Reference frame at scaled (%d) timecode %ld\n", std::int32_t(RefTime), std::int32_t(std::int64_t(RefTime) * TimecodeScale)); } else if (EbmlId(*ElementLevel3) == KaxBlockDuration::ClassInfos.GlobalId) { KaxBlockDuration & BlockDuration = *static_cast(ElementLevel3); BlockDuration.ReadData(aStream.I_O()); - printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(BlockDuration), uint32(BlockDuration) * TimecodeScale); + printf(" Block Duration %d scaled ticks : %ld ns\n", std::uint32_t(BlockDuration), std::uint32_t(BlockDuration) * TimecodeScale); } if (UpperElementLevel > 0) { UpperElementLevel--; @@ -437,8 +437,8 @@ int main(int argc, char **argv) #endif // not MEMORY_READ if (pChecksum != NULL) { EbmlCrc32 ComputedChecksum; - uint64 CurrPosition = aStream.I_O().getFilePointer(); - uint64 CrcPositionEnd = ElementLevel2->GetElementPosition(); + std::uint64_t CurrPosition = aStream.I_O().getFilePointer(); + std::uint64_t CrcPositionEnd = ElementLevel2->GetElementPosition(); binary *SupposedBufferInCrc = new binary [CrcPositionEnd - CrcPositionStart]; aStream.I_O().setFilePointer(CrcPositionStart); aStream.I_O().readFully(SupposedBufferInCrc, CrcPositionEnd - CrcPositionStart); @@ -477,7 +477,7 @@ int main(int argc, char **argv) for (Index1 = 0; Index1Generic().GlobalId == KaxCueTime::ClassInfos.GlobalId) { KaxCueTime & CueTime = *static_cast(CuePoint[Index1]); - printf(" Time %ld\n", uint64(CueTime) * TimecodeScale); + printf(" Time %ld\n", std::uint64_t(CueTime) * TimecodeScale); } else if (CuePoint[Index1]->Generic().GlobalId == KaxCueTrackPositions::ClassInfos.GlobalId) { KaxCueTrackPositions & CuePos = *static_cast(CuePoint[Index1]); printf(" Positions\n"); @@ -486,10 +486,10 @@ int main(int argc, char **argv) for (Index2 = 0; Index2Generic().GlobalId == KaxCueTrack::ClassInfos.GlobalId) { KaxCueTrack & CueTrack = *static_cast(CuePos[Index2]); - printf(" Track %d\n", uint16(CueTrack)); + printf(" Track %d\n", std::uint16_t(CueTrack)); } else if (CuePos[Index2]->Generic().GlobalId == KaxCueClusterPosition::ClassInfos.GlobalId) { KaxCueClusterPosition & CuePoss = *static_cast(CuePos[Index2]); - printf(" Cluster position %d\n", uint64(CuePoss)); + printf(" Cluster position %d\n", std::uint64_t(CuePoss)); } else if (CuePos[Index2]->Generic().GlobalId == KaxCueReference::ClassInfos.GlobalId) { KaxCueReference & CueRefs = *static_cast(CuePos[Index2]); printf(" Reference\n"); @@ -498,10 +498,10 @@ int main(int argc, char **argv) for (Index3 = 0; Index3Generic().GlobalId == KaxCueRefTime::ClassInfos.GlobalId) { KaxCueRefTime & CueTime = *static_cast(CueRefs[Index3]); - printf(" Time %d\n", uint32(CueTime)); + printf(" Time %d\n", std::uint32_t(CueTime)); } else if (CueRefs[Index3]->Generic().GlobalId == KaxCueRefCluster::ClassInfos.GlobalId) { KaxCueRefCluster & CueClust = *static_cast(CueRefs[Index3]); - printf(" Cluster position %d\n", uint64(CueClust)); + printf(" Cluster position %d\n", std::uint64_t(CueClust)); } else { printf(" - found %s\n", CueRefs[Index3]->Generic().DebugName); } @@ -545,7 +545,7 @@ int main(int argc, char **argv) printf("\n"); } else if (SeekPoint[Index1]->Generic().GlobalId == KaxSeekPosition::ClassInfos.GlobalId) { KaxSeekPosition * SeekPos = static_cast(SeekPoint[Index1]); - printf(" Seek position %d\n", uint32(*SeekPos)); + printf(" Seek position %d\n", std::uint32_t(*SeekPos)); } } } @@ -573,11 +573,11 @@ int main(int argc, char **argv) unsigned int Index3; for (Index3 = 0; Index3Generic().GlobalId == KaxChapterUID::ClassInfos.GlobalId) { - printf(" Chapter UID 0x%08x\n", uint32(*static_cast(aChapterAtom[Index3])) ); + printf(" Chapter UID 0x%08x\n", std::uint32_t(*static_cast(aChapterAtom[Index3])) ); } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeStart::ClassInfos.GlobalId) { - printf(" Time Start %d\n", uint32(*static_cast(aChapterAtom[Index3])) ); + printf(" Time Start %d\n", std::uint32_t(*static_cast(aChapterAtom[Index3])) ); } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeEnd::ClassInfos.GlobalId) { - printf(" Time End %d ns\n", uint32(*static_cast(aChapterAtom[Index3])) ); + printf(" Time End %d ns\n", std::uint32_t(*static_cast(aChapterAtom[Index3])) ); } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTrack::ClassInfos.GlobalId) { printf(" Track list\n"); } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterDisplay::ClassInfos.GlobalId) { @@ -749,7 +749,7 @@ int main(int argc, char **argv) } #ifdef OLD - uint8 TrackNumber = MuxedFile.GetTrackNumber(); + std::uint8_t TrackNumber = MuxedFile.GetTrackNumber(); TrackInfo *Tracks = new TrackInfo[TrackNumber]; TrackInfoAudio aAudioTrack; @@ -795,9 +795,9 @@ int main(int argc, char **argv) StdIOCallback Output_file3("out-vide.bin", MODE_CREATE); Track * TrackRead; - uint32 timecode; // not used yet + std::uint32_t timecode; // not used yet binary *aFrame; - uint32 aFrameSize; + std::uint32_t aFrameSize; while (MuxedFile.ReadFrame(TrackRead, timecode, aFrame, aFrameSize)) { if (TrackRead == track1)