/xbmc/cores/playercorefactory/PlayerCoreFactory.h

http://github.com/xbmc/xbmc · C Header · 68 lines · 46 code · 13 blank · 9 comment · 0 complexity · ade21b4295fb92f3be034738b056ce78 MD5 · raw file

  1. /*
  2. * Copyright (C) 2005-2018 Team Kodi
  3. * This file is part of Kodi - https://kodi.tv
  4. *
  5. * SPDX-License-Identifier: GPL-2.0-or-later
  6. * See LICENSES/README.md for more information.
  7. */
  8. #pragma once
  9. #include "settings/lib/ISettingsHandler.h"
  10. #include "threads/CriticalSection.h"
  11. #include <memory>
  12. #include <string>
  13. #include <vector>
  14. // forward references
  15. class TiXmlElement;
  16. class CFileItem;
  17. class CPlayerCoreConfig;
  18. class CPlayerSelectionRule;
  19. class CProfileManager;
  20. class CSettings;
  21. class IPlayer;
  22. class IPlayerCallback;
  23. class CPlayerCoreFactory : public ISettingsHandler
  24. {
  25. public:
  26. CPlayerCoreFactory(const CProfileManager &profileManager);
  27. CPlayerCoreFactory(const CPlayerCoreFactory&) = delete;
  28. CPlayerCoreFactory& operator=(CPlayerCoreFactory const&) = delete;
  29. ~CPlayerCoreFactory() override;
  30. void OnSettingsLoaded() override;
  31. IPlayer* CreatePlayer(const std::string& nameId, IPlayerCallback& callback) const;
  32. void GetPlayers(const CFileItem& item, std::vector<std::string>&players) const; //Players supporting the specified file
  33. void GetPlayers(std::vector<std::string>&players, bool audio, bool video) const; //All audio players and/or video players
  34. void GetPlayers(std::vector<std::string>&players) const; //All players
  35. void GetPlayers(std::vector<std::string>&players, std::string &type) const;
  36. void GetRemotePlayers(std::vector<std::string>&players) const; //All remote players we can attach to
  37. std::string GetPlayerType(const std::string &player) const;
  38. bool PlaysAudio(const std::string &player) const;
  39. bool PlaysVideo(const std::string &player) const;
  40. std::string GetDefaultPlayer(const CFileItem& item) const;
  41. std::string SelectPlayerDialog(const std::vector<std::string>&players, float posX = 0, float posY = 0) const;
  42. std::string SelectPlayerDialog(float posX, float posY) const;
  43. void OnPlayerDiscovered(const std::string& id, const std::string& name);
  44. void OnPlayerRemoved(const std::string& id);
  45. private:
  46. // Construction parameters
  47. std::shared_ptr<CSettings> m_settings;
  48. const CProfileManager &m_profileManager;
  49. int GetPlayerIndex(const std::string& strCoreName) const;
  50. std::string GetPlayerName(size_t idx) const;
  51. bool LoadConfiguration(const std::string &file, bool clear);
  52. std::vector<CPlayerCoreConfig *> m_vecPlayerConfigs;
  53. std::vector<CPlayerSelectionRule *> m_vecCoreSelectionRules;
  54. mutable CCriticalSection m_section;
  55. };