[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / addons / ExtsMimeSupportList.h
blobf7e8d475eb0f018d1d615f4e45b575556aac46f5
1 /*
2 * Copyright (C) 2005-2021 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 "addons/IAddonSupportList.h"
12 #include "threads/CriticalSection.h"
14 #include <map>
15 #include <memory>
16 #include <string>
17 #include <utility>
18 #include <vector>
20 namespace ADDON
22 enum class AddonType;
23 class CAddonMgr;
24 class CAddonInfo;
26 struct AddonEvent;
29 namespace KODI
31 namespace ADDONS
34 /*!
35 * @brief Class to manage all available and activated add-ons and
36 * to release their types to the outside for selection.
38 * @note It may also make sense in the future to expand this class and design it
39 * globally in Kodi so that other addons can also be managed with it (all which
40 * have mimetypes and file extensions, e.g. vfs, audioencoder).
42 class CExtsMimeSupportList : public KODI::ADDONS::IAddonSupportList
44 public:
45 CExtsMimeSupportList(ADDON::CAddonMgr& addonMgr);
46 ~CExtsMimeSupportList();
48 /*!
49 * @brief Filter selection values.
51 enum class FilterSelect
53 /*! To select all available */
54 all,
56 /*! To select only them where support tags */
57 hasTags,
59 /*! Get only where support tracks within */
60 hasTracks
63 /*!
64 * @brief Structure to store information about supported part.
66 struct SupportValue
68 SupportValue(int description, std::string icon)
69 : m_description(description), m_icon(std::move(icon))
73 // Description text about supported part
74 int m_description;
76 // Own by addon defined icon path
77 std::string m_icon;
80 /*!
81 * @brief Structure to store available data for related addon.
83 struct SupportValues
85 // Type of stored addon to check on scan
86 ADDON::AddonType m_addonType{};
88 // Related addon info class
89 std::shared_ptr<ADDON::CAddonInfo> m_addonInfo;
91 // Addon his own codec identification name
92 std::string m_codecName;
94 // If as true support addons own song information tags
95 bool m_hasTags{false};
97 // To know addon includes several tracks inside one file, if set to true
98 bool m_hasTracks{false};
100 // List of supported file extensions by addon
101 // First: Extension name
102 // Second: With @ref SupportValue defined content
103 std::map<std::string, SupportValue> m_supportedExtensions;
105 // List of supported mimetypes by addon
106 // First: Mimetype name
107 // Second: With @ref SupportValue defined content
108 std::map<std::string, SupportValue> m_supportedMimetypes;
112 * @brief Get list of all by audiodecoder supported parts.
114 * Thought to use on planned new window about management about supported
115 * extensions and mimetypes in Kodi and to allow edit by user to enable or
116 * disable corresponding parts.
118 * This function is also used to notify Kodi supported formats and to allow
119 * playback.
121 * @param[in] select To filter the listed information by type
122 * @return List of the available types listed for the respective add-on
124 std::vector<SupportValues> GetSupportedAddonInfos(FilterSelect select);
127 * @brief To query the desired file extension is supported in it.
129 * @param[in] ext Extension name to check
130 * @return True if within supported, false if not
132 bool IsExtensionSupported(const std::string& ext);
135 * @brief To get a list of all compatible audio decoder add-ons for the file extension.
137 * @param[in] ext Extension name to check
138 * @param[in] select To filter the listed information by type
139 * @return List of @ref ADDON::CAddonInfo where support related extension
141 std::vector<std::pair<ADDON::AddonType, std::shared_ptr<ADDON::CAddonInfo>>>
142 GetExtensionSupportedAddonInfos(const std::string& ext, FilterSelect select);
145 * @brief To query the desired file mimetype is supported in it.
147 * @param[in] mimetype Mimetype name to check
148 * @return True if within supported, false if not
150 bool IsMimetypeSupported(const std::string& mimetype);
153 * @brief To get a list of all compatible audio decoder add-ons for the mimetype.
155 * @param[in] mimetype Mimetype name to check
156 * @param[in] select To filter the listed information by type
157 * @return List of @ref ADDON::CAddonInfo where support related mimetype
159 std::vector<std::pair<ADDON::AddonType, std::shared_ptr<ADDON::CAddonInfo>>>
160 GetMimetypeSupportedAddonInfos(const std::string& mimetype, FilterSelect select);
163 * @brief To give all file extensions and MIME types supported by the addon.
165 * @param[in] addonId Identifier about wanted addon
166 * @return List of all supported parts on selected addon
168 * @sa KODI::ADDONS::IAddonSupportList
170 std::vector<KODI::ADDONS::AddonSupportEntry> GetSupportedExtsAndMimeTypes(
171 const std::string& addonId) override;
173 protected:
174 void Update(const std::string& id);
175 void OnEvent(const ADDON::AddonEvent& event);
177 static SupportValues ScanAddonProperties(ADDON::AddonType type,
178 const std::shared_ptr<ADDON::CAddonInfo>& addonInfo);
180 CCriticalSection m_critSection;
182 std::vector<SupportValues> m_supportedList;
183 ADDON::CAddonMgr& m_addonMgr;
186 } /* namespace ADDONS */
187 } /* namespace KODI */