Skip to content

Commit

Permalink
MatroskaMuxer: упрощаем класс CLength.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Nov 29, 2024
1 parent f728bd4 commit 2754ff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2022 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -246,7 +246,7 @@ HRESULT CInt::Write(IStream* pStream)
return pStream->Write(&val, (ULONG)l, nullptr);
}

UINT64 CLength::Size(bool fWithHeader)
UINT64 CLength::Size()
{
if (m_len == 0x00FFFFFFFFFFFFFFi64) {
return 8;
Expand All @@ -264,7 +264,7 @@ UINT64 CLength::Size(bool fWithHeader)

HRESULT CLength::Write(IStream* pStream)
{
UINT64 len = Size(false);
UINT64 len = Size();
UINT64 val = m_len;
bswap((BYTE*)&val, (int)len);
*(BYTE*)&val = ((*(BYTE*)&val) & (1 << (8 - len)) - 1) | (1 << (8 - len));
Expand Down
10 changes: 5 additions & 5 deletions src/filters/muxer/MatroskaMuxer/MatroskaFile.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2023 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -39,16 +39,16 @@ namespace MatroskaWriter
virtual HRESULT Write(IStream* pStream);
};

class CLength : public CID
class CLength final
{
UINT64 m_len;
public:
CLength(UINT64 len = 0) : CID(0), m_len(len) {}
CLength(UINT64 len = 0) : m_len(len) {}
operator UINT64() {
return m_len;
}
UINT64 Size(bool fWithHeader = false) override;
HRESULT Write(IStream* pStream) override;
UINT64 Size();
HRESULT Write(IStream* pStream);
};

class CBinary : public std::vector<BYTE>, public CID
Expand Down

0 comments on commit 2754ff4

Please sign in to comment.