diff options
-rw-r--r-- | system/keymaps/keyboard.xml | 1 | ||||
-rw-r--r-- | xbmc/Application.cpp | 30 | ||||
-rw-r--r-- | xbmc/cores/playercorefactory/PlayerCoreFactory.cpp | 11 | ||||
-rw-r--r-- | xbmc/cores/playercorefactory/PlayerCoreFactory.h | 2 | ||||
-rw-r--r-- | xbmc/guilib/Key.h | 2 | ||||
-rw-r--r-- | xbmc/input/ButtonTranslator.cpp | 1 |
6 files changed, 47 insertions, 0 deletions
diff --git a/system/keymaps/keyboard.xml b/system/keymaps/keyboard.xml index a6431eb1aa..ae5cf96cad 100644 --- a/system/keymaps/keyboard.xml +++ b/system/keymaps/keyboard.xml @@ -41,6 +41,7 @@ <q>Queue</q> <f>FastForward</f> <r>Rewind</r> + <y>SwitchPlayer</y> <left>Left</left> <right>Right</right> <up>Up</up> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 0a8a6df8ec..8a00fd8258 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2847,6 +2847,36 @@ bool CApplication::OnAction(const CAction &action) } } + + if (action.GetID() == ACTION_SWITCH_PLAYER) + { + if(IsPlaying()) + { + VECPLAYERCORES cores; + CFileItem item(*m_itemCurrentFile.get()); + CPlayerCoreFactory::GetPlayers(item, cores); + PLAYERCOREID core = CPlayerCoreFactory::SelectPlayerDialog(cores); + if(core != EPC_NONE) + { + g_application.m_eForcedNextPlayer = core; + item.m_lStartOffset = GetTime() * 75; + PlayFile(item, true); + } + } + else + { + VECPLAYERCORES cores; + CPlayerCoreFactory::GetRemotePlayers(cores); + PLAYERCOREID core = CPlayerCoreFactory::SelectPlayerDialog(cores); + if(core != EPC_NONE) + { + CFileItem item; + g_application.m_eForcedNextPlayer = core; + PlayFile(item, false); + } + } + } + if (g_peripherals.OnAction(action)) return true; diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp index 707e86a36c..658cb606be 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp @@ -232,6 +232,17 @@ void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecC CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: added %"PRIuS" players", vecCores.size()); } +void CPlayerCoreFactory::GetRemotePlayers( VECPLAYERCORES &vecCores ) +{ + CSingleLock lock(s_section); + for(unsigned int i = 0; i < s_vecCoreConfigs.size(); i++) + { + if(s_vecCoreConfigs[i]->m_eCore != EPC_UPNPPLAYER) + continue; + vecCores.push_back(i+1); + } +} + PLAYERCOREID CPlayerCoreFactory::GetDefaultPlayer( const CFileItem& item ) { VECPLAYERCORES vecCores; diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.h b/xbmc/cores/playercorefactory/PlayerCoreFactory.h index fa7064bd33..27f72e8703 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.h +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.h @@ -76,6 +76,8 @@ public: static void GetPlayers( VECPLAYERCORES &vecCores, bool audio, bool video ); //All audio players and/or video players static void GetPlayers( VECPLAYERCORES &vecCores ); //All players + static void GetRemotePlayers( VECPLAYERCORES &vecCores ); //All remote players we can attach to + static PLAYERCOREID GetDefaultPlayer( const CFileItem& item ); static PLAYERCOREID SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX = 0, float posY = 0); diff --git a/xbmc/guilib/Key.h b/xbmc/guilib/Key.h index 10aa356f06..029b75510a 100644 --- a/xbmc/guilib/Key.h +++ b/xbmc/guilib/Key.h @@ -315,6 +315,8 @@ #define ACTION_FILTER 233 +#define ACTION_SWITCH_PLAYER 234 + // Window ID defines to make the code a bit more readable #define WINDOW_INVALID 9999 #define WINDOW_HOME 10000 diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 9152a302b5..5056a6de35 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -142,6 +142,7 @@ static const ActionMapping actions[] = {"rewind" , ACTION_PLAYER_REWIND}, {"play" , ACTION_PLAYER_PLAY}, {"playpause" , ACTION_PLAYER_PLAYPAUSE}, + {"switchplayer" , ACTION_SWITCH_PLAYER}, {"delete" , ACTION_DELETE_ITEM}, {"copy" , ACTION_COPY_ITEM}, {"move" , ACTION_MOVE_ITEM}, |