04ac1dc3aac2be6b5f0a107f5a2a00254f5ff4d4
[vuplus_xbmc] / xbmc / cores / playercorefactory / PlayerCoreFactory.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2008 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, write to
19  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20  *  http://www.gnu.org/copyleft/gpl.html
21  *
22  */
23
24 #include "../IPlayer.h"
25
26 /*----------------------------------------------------------------------
27 |   forward references
28 +---------------------------------------------------------------------*/
29 class TiXmlElement;
30 class CPlayerCoreConfig;
31 class CPlayerSelectionRule;
32
33 // do not remove mplayer - will break scripts
34 enum EPLAYERCORES
35 {
36   EPC_NONE,
37   EPC_DVDPLAYER,
38   EPC_MPLAYER,
39   EPC_PAPLAYER,
40   EPC_EXTPLAYER
41 };
42
43 typedef unsigned int PLAYERCOREID;
44 typedef std::vector<PLAYERCOREID> VECPLAYERCORES;
45 const PLAYERCOREID PCID_NONE = 0;
46 const PLAYERCOREID PCID_DVDPLAYER = 1;
47 const PLAYERCOREID PCID_MPLAYER = 2;
48 const PLAYERCOREID PCID_PAPLAYER = 3;
49
50 class CPlayerCoreFactory
51 {
52 public:
53   CPlayerCoreFactory();
54   virtual ~CPlayerCoreFactory();
55
56   IPlayer* CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const;
57
58   static PLAYERCOREID GetPlayerCore(const CStdString& strCoreName);
59   static CPlayerCoreConfig* GetPlayerConfig(const CStdString& strCoreName);
60   static CStdString GetPlayerName(const PLAYERCOREID eCore);
61
62   static IPlayer* CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback);
63   static void GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores);   //Players supporting the specified file
64   static void GetPlayers( VECPLAYERCORES &vecCores, bool audio, bool video ); //All audio players and/or video players
65   static void GetPlayers( VECPLAYERCORES &vecCores );                         //All players
66
67   static PLAYERCOREID GetDefaultPlayer( const CFileItem& item );
68
69   static PLAYERCOREID SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX = 0, float posY = 0);
70   static PLAYERCOREID SelectPlayerDialog(float posX, float posY);
71
72   static bool LoadConfiguration(TiXmlElement* pConfig, bool clear);
73
74 private:
75   static std::vector<CPlayerCoreConfig *> s_vecCoreConfigs;
76   static std::vector<CPlayerSelectionRule *> s_vecCoreSelectionRules;
77 };