[video] fix selection after changing video or extra art
[xbmc.git] / xbmc / imagefiles / SpecialImageLoaderFactory.cpp
blob86730317972ccd8de0fd8f57b24c7aa9fc64347c
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 "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())
37 return {};
38 for (auto& loader : m_specialImageLoaders)
40 if (loader->CanLoad(specialType))
42 auto val = loader->Load(specialType, filePath, preferredWidth, preferredHeight);
43 if (val)
44 return val;
47 return {};