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 "SpecialImageLoaderFactory.h"
11 #include "guilib/Texture.h"
12 #include "music/MusicEmbeddedImageFileLoader.h"
13 #include "pictures/PictureFolderImageFileLoader.h"
14 #include "pvr/PVRChannelGroupImageFileLoader.h"
15 #include "video/VideoChapterImageFileLoader.h"
16 #include "video/VideoEmbeddedImageFileLoader.h"
17 #include "video/VideoGeneratedImageFileLoader.h"
19 using namespace IMAGE_FILES
;
21 CSpecialImageLoaderFactory::CSpecialImageLoaderFactory()
23 m_specialImageLoaders
[0] = std::make_unique
<VIDEO::CVideoEmbeddedImageFileLoader
>();
24 m_specialImageLoaders
[1] = std::make_unique
<MUSIC_INFO::CMusicEmbeddedImageFileLoader
>();
25 m_specialImageLoaders
[2] = std::make_unique
<VIDEO::CVideoGeneratedImageFileLoader
>();
26 m_specialImageLoaders
[3] = std::make_unique
<CPictureFolderImageFileLoader
>();
27 m_specialImageLoaders
[4] = std::make_unique
<VIDEO::CVideoChapterImageFileLoader
>();
28 m_specialImageLoaders
[5] = std::make_unique
<PVR::CPVRChannelGroupImageFileLoader
>();
31 std::unique_ptr
<CTexture
> CSpecialImageLoaderFactory::Load(const std::string
& specialType
,
32 const std::string
& filePath
,
33 unsigned int preferredWidth
,
34 unsigned int preferredHeight
) const
36 if (specialType
.empty())
38 for (auto& loader
: m_specialImageLoaders
)
40 if (loader
->CanLoad(specialType
))
42 auto val
= loader
->Load(specialType
, filePath
, preferredWidth
, preferredHeight
);