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.
9 #include "MusicEmbeddedImageFileLoader.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";
27 bool GetEmbeddedThumb(const std::string
& path
, EmbeddedArt
& art
)
29 CFileItem
item(path
, false);
30 std::unique_ptr
<IMusicInfoTagLoader
> loader(CMusicInfoTagLoaderFactory::CreateLoader(item
));
33 loader
->Load(path
, tag
, &art
);
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
45 if (GetEmbeddedThumb(filePath
, art
))
46 return CTexture::LoadFromFileInMemory(art
.m_data
.data(), art
.m_size
, art
.m_mime
, preferredWidth
,