summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/XBTF.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/guilib/XBTF.h
parentInitial commit. (diff)
downloadkodi-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/guilib/XBTF.h')
-rw-r--r--xbmc/guilib/XBTF.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/xbmc/guilib/XBTF.h b/xbmc/guilib/XBTF.h
new file mode 100644
index 0000000..3829439
--- /dev/null
+++ b/xbmc/guilib/XBTF.h
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <ctime>
+#include <map>
+#include <string>
+#include <vector>
+
+#include <stdint.h>
+
+static const std::string XBTF_MAGIC = "XBTF";
+static const std::string XBTF_VERSION = "2";
+
+#include "TextureFormats.h"
+
+class CXBTFFrame
+{
+public:
+ CXBTFFrame();
+
+ uint32_t GetWidth() const;
+ void SetWidth(uint32_t width);
+
+ uint32_t GetFormat(bool raw = false) const;
+ void SetFormat(uint32_t format);
+
+ uint32_t GetHeight() const;
+ void SetHeight(uint32_t height);
+
+ uint64_t GetUnpackedSize() const;
+ void SetUnpackedSize(uint64_t size);
+
+ uint64_t GetPackedSize() const;
+ void SetPackedSize(uint64_t size);
+
+ uint64_t GetOffset() const;
+ void SetOffset(uint64_t offset);
+
+ uint64_t GetHeaderSize() const;
+
+ uint32_t GetDuration() const;
+ void SetDuration(uint32_t duration);
+
+ bool IsPacked() const;
+ bool HasAlpha() const;
+
+private:
+ uint32_t m_width;
+ uint32_t m_height;
+ uint32_t m_format;
+ uint64_t m_packedSize;
+ uint64_t m_unpackedSize;
+ uint64_t m_offset;
+ uint32_t m_duration;
+};
+
+class CXBTFFile
+{
+public:
+ CXBTFFile();
+
+ const std::string& GetPath() const;
+ void SetPath(const std::string& path);
+
+ uint32_t GetLoop() const;
+ void SetLoop(uint32_t loop);
+
+ const std::vector<CXBTFFrame>& GetFrames() const;
+ std::vector<CXBTFFrame>& GetFrames();
+
+ uint64_t GetPackedSize() const;
+ uint64_t GetUnpackedSize() const;
+ uint64_t GetHeaderSize() const;
+
+ static const size_t MaximumPathLength = 256;
+
+private:
+ std::string m_path;
+ uint32_t m_loop = 0;
+ std::vector<CXBTFFrame> m_frames;
+};
+
+class CXBTFBase
+{
+public:
+ virtual ~CXBTFBase() = default;
+
+ uint64_t GetHeaderSize() const;
+
+ bool Exists(const std::string& name) const;
+ bool Get(const std::string& name, CXBTFFile& file) const;
+ std::vector<CXBTFFile> GetFiles() const;
+ void AddFile(const CXBTFFile& file);
+ void UpdateFile(const CXBTFFile& file);
+
+protected:
+ CXBTFBase() = default;
+
+ std::map<std::string, CXBTFFile> m_files;
+};