[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / music / MusicEmbeddedImageFileLoader.cpp
blob212f51823f86fe9d5bbf80049b4bc611445e28dc
1 /*
2 * Copyright (C) 2023 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 #include "MusicEmbeddedImageFileLoader.h"
11 #include "FileItem.h"
12 #include "guilib/Texture.h"
13 #include "music/tags/ImusicInfoTagLoader.h"
14 #include "music/tags/MusicInfoTag.h"
15 #include "music/tags/MusicInfoTagLoaderFactory.h"
16 #include "utils/EmbeddedArt.h"
18 using namespace MUSIC_INFO;
20 bool CMusicEmbeddedImageFileLoader::CanLoad(const std::string& specialType) const
22 return specialType == "music";
25 namespace
27 bool GetEmbeddedThumb(const std::string& path, EmbeddedArt& art)
29 CFileItem item(path, false);
30 std::unique_ptr<IMusicInfoTagLoader> loader(CMusicInfoTagLoaderFactory::CreateLoader(item));
31 CMusicInfoTag tag;
32 if (loader)
33 loader->Load(path, tag, &art);
35 return !art.Empty();
37 } // namespace
39 std::unique_ptr<CTexture> CMusicEmbeddedImageFileLoader::Load(const std::string& specialType,
40 const std::string& filePath,
41 unsigned int preferredWidth,
42 unsigned int preferredHeight) const
44 EmbeddedArt art;
45 if (GetEmbeddedThumb(filePath, art))
46 return CTexture::LoadFromFileInMemory(art.m_data.data(), art.m_size, art.m_mime, preferredWidth,
47 preferredHeight);
48 return nullptr;