diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/utils/EmbeddedArt.cpp | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/utils/EmbeddedArt.cpp')
-rw-r--r-- | xbmc/utils/EmbeddedArt.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/xbmc/utils/EmbeddedArt.cpp b/xbmc/utils/EmbeddedArt.cpp new file mode 100644 index 0000000..3af2259 --- /dev/null +++ b/xbmc/utils/EmbeddedArt.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2005-2018 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#include "EmbeddedArt.h" + +#include "Archive.h" + +EmbeddedArtInfo::EmbeddedArtInfo(size_t size, + const std::string &mime, const std::string& type) +{ + Set(size, mime, type); +} + +void EmbeddedArtInfo::Set(size_t size, const std::string &mime, const std::string& type) +{ + m_size = size; + m_mime = mime; + m_type = type; +} + +void EmbeddedArtInfo::Clear() +{ + m_mime.clear(); + m_size = 0; +} + +bool EmbeddedArtInfo::Empty() const +{ + return m_size == 0; +} + +bool EmbeddedArtInfo::Matches(const EmbeddedArtInfo &right) const +{ + return (m_size == right.m_size && + m_mime == right.m_mime && + m_type == right.m_type); +} + +void EmbeddedArtInfo::Archive(CArchive &ar) +{ + if (ar.IsStoring()) + { + ar << m_size; + ar << m_mime; + ar << m_type; + } + else + { + ar >> m_size; + ar >> m_mime; + ar >> m_type; + } +} + +EmbeddedArt::EmbeddedArt(const uint8_t *data, size_t size, + const std::string &mime, const std::string& type) +{ + Set(data, size, mime, type); +} + +void EmbeddedArt::Set(const uint8_t *data, size_t size, + const std::string &mime, const std::string& type) +{ + EmbeddedArtInfo::Set(size, mime, type); + m_data.resize(size); + m_data.assign(data, data+size); +} |