[WASAPI] fix stream types and frequencies enumeration
[xbmc.git] / xbmc / guilib / TextureBundleXBT.h
blob304605607fc9dceea9d7ac8da539474d88c15775
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 "Texture.h"
13 #include <cstdint>
14 #include <ctime>
15 #include <memory>
16 #include <optional>
17 #include <string>
18 #include <utility>
19 #include <vector>
21 class CXBTFReader;
22 class CXBTFFrame;
24 class CTextureBundleXBT
26 public:
27 CTextureBundleXBT();
28 explicit CTextureBundleXBT(bool themeBundle);
29 ~CTextureBundleXBT();
31 void SetThemeBundle(bool themeBundle);
32 bool HasFile(const std::string& Filename);
33 std::vector<std::string> GetTexturesFromPath(const std::string& path);
34 static std::string Normalize(std::string name);
36 struct Texture
38 std::unique_ptr<CTexture> texture;
39 int width;
40 int height;
43 /*!
44 * \brief See CTextureBundle::LoadTexture
46 std::optional<Texture> LoadTexture(const std::string& filename);
48 struct Animation
50 std::vector<std::pair<std::unique_ptr<CTexture>, int>> textures;
51 int width;
52 int height;
53 int loops;
56 /*!
57 * \brief See CTextureBundle::LoadAnim
59 std::optional<Animation> LoadAnim(const std::string& filename);
61 //! @todo Change return to std::optional<std::vector<uint8_t>>> when c++17 is allowed
62 static std::vector<uint8_t> UnpackFrame(const CXBTFReader& reader, const CXBTFFrame& frame);
64 void CloseBundle();
66 private:
67 bool OpenBundle();
68 std::unique_ptr<CTexture> ConvertFrameToTexture(const std::string& name, const CXBTFFrame& frame);
70 time_t m_TimeStamp;
72 bool m_themeBundle;
73 std::string m_path;
74 std::shared_ptr<CXBTFReader> m_XBTFReader;