[ExecString] combine SplitParameters with identical function of CUtil
[xbmc.git] / xbmc / guilib / XBTF.h
blob588ba6234decef242ff5f31dda023fbe5a9ee05d
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <ctime>
12 #include <map>
13 #include <string>
14 #include <vector>
16 #include <stdint.h>
18 static const std::string XBTF_MAGIC = "XBTF";
19 static const std::string XBTF_VERSION = "2";
21 #include "TextureFormats.h"
23 class CXBTFFrame
25 public:
26 CXBTFFrame();
28 uint32_t GetWidth() const;
29 void SetWidth(uint32_t width);
31 XB_FMT GetFormat(bool raw = false) const;
32 void SetFormat(XB_FMT format);
34 uint32_t GetHeight() const;
35 void SetHeight(uint32_t height);
37 uint64_t GetUnpackedSize() const;
38 void SetUnpackedSize(uint64_t size);
40 uint64_t GetPackedSize() const;
41 void SetPackedSize(uint64_t size);
43 uint64_t GetOffset() const;
44 void SetOffset(uint64_t offset);
46 uint64_t GetHeaderSize() const;
48 uint32_t GetDuration() const;
49 void SetDuration(uint32_t duration);
51 bool IsPacked() const;
52 bool HasAlpha() const;
54 private:
55 uint32_t m_width;
56 uint32_t m_height;
57 XB_FMT m_format;
58 uint64_t m_packedSize;
59 uint64_t m_unpackedSize;
60 uint64_t m_offset;
61 uint32_t m_duration;
64 class CXBTFFile
66 public:
67 CXBTFFile();
69 const std::string& GetPath() const;
70 void SetPath(const std::string& path);
72 uint32_t GetLoop() const;
73 void SetLoop(uint32_t loop);
75 const std::vector<CXBTFFrame>& GetFrames() const;
76 std::vector<CXBTFFrame>& GetFrames();
78 uint64_t GetPackedSize() const;
79 uint64_t GetUnpackedSize() const;
80 uint64_t GetHeaderSize() const;
82 static const size_t MaximumPathLength = 256;
84 private:
85 std::string m_path;
86 uint32_t m_loop = 0;
87 std::vector<CXBTFFrame> m_frames;
90 class CXBTFBase
92 public:
93 virtual ~CXBTFBase() = default;
95 uint64_t GetHeaderSize() const;
97 bool Exists(const std::string& name) const;
98 bool Get(const std::string& name, CXBTFFile& file) const;
99 std::vector<CXBTFFile> GetFiles() const;
100 void AddFile(const CXBTFFile& file);
101 void UpdateFile(const CXBTFFile& file);
103 protected:
104 CXBTFBase() = default;
106 std::map<std::string, CXBTFFile> m_files;