Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
jsonrpc: refactor (Audio|Video|Picture)Player and (Audio|Video)Playlist
Browse files Browse the repository at this point in the history
Merged AudioPlayer, VideoPlayer and PicturePlayer into Player (thanks topfs2)
Merged AudioPlaylist and VideoPlaylist to replace Playlist and provide initial support for picture playlists (aka slideshows)
Players/Playlists are no longer accessed by their media type (video, audio, picture) but by a unique ID. Active players/playlists (their ID and media type) can still be retrieved using Player.GetActivePlayers/Playlist.GetPlaylists
Replaced Playlist.State with Playlist.GetProperties
Replaced Player.State, Player.GetTime and Player.GetPercentage with Player.GetProperties
Removed Playlist.SkipPrevious and Playlist.SkipNext (use Player.GoPrevious and Player.GoNext instead)
The following methods have been moved from the Playlist to the Player namespace: Play (renamed to Open), Shuffle, UnShuffle, Repeat
Refactored notifications for the Player namespace
Unified naming of position/item/index parameters in Player and Playlist namespaces
Merged XBMC.Play and XBMC.StartSlideshow into Player.Open
Make Playlist.Add, Playlist.Clear and Player.Open work for picture playlists (closes #11219)
Removed (Big|Small)Skip(Forward|Backward) from Player namespace
Replace Rewind and Forward with SetSpeed in Player namespace
Replace "value" parameter in "Player.SeekTime" with time struct parameters (thanks darwin; closes #11474)
Merge SeekTime, SeekPercentage and (Small|Big)Skip(Forward|Backward) into Seek in Player namespace
  • Loading branch information
Montellese committed Sep 18, 2011
1 parent da78eaa commit c4f161e
Show file tree
Hide file tree
Showing 27 changed files with 1,961 additions and 2,576 deletions.
6 changes: 0 additions & 6 deletions project/VS2010Express/XBMC.vcxproj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -460,14 +460,11 @@
<ClCompile Include="..\..\xbmc\interfaces\info\InfoBool.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\info\InfoBool.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\InputOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\InputOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\SystemOperations.cpp" /> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\SystemOperations.cpp" />
Expand Down Expand Up @@ -1385,8 +1382,6 @@
<ClInclude Include="..\..\xbmc\interfaces\info\InfoBool.h" /> <ClInclude Include="..\..\xbmc\interfaces\info\InfoBool.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileOperations.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\IClient.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\IClient.h" />
Expand All @@ -1395,7 +1390,6 @@
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\ServiceDescription.h" /> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\ServiceDescription.h" />
Expand Down
18 changes: 0 additions & 18 deletions project/VS2010Express/XBMC.vcxproj.filters
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1472,12 +1472,6 @@
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp"> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.cpp">
<Filter>interfaces\json-rpc</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.cpp">
<Filter>interfaces\json-rpc</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp"> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClCompile> </ClCompile>
Expand All @@ -1487,9 +1481,6 @@
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp"> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.cpp">
<Filter>interfaces\json-rpc</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp"> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClCompile> </ClCompile>
Expand Down Expand Up @@ -3937,12 +3928,6 @@
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h"> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h"> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClInclude> </ClInclude>
Expand All @@ -3961,9 +3946,6 @@
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h"> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h"> <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h">
<Filter>interfaces\json-rpc</Filter> <Filter>interfaces\json-rpc</Filter>
</ClInclude> </ClInclude>
Expand Down
24 changes: 16 additions & 8 deletions xbmc/Application.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3898,7 +3898,10 @@ void CApplication::OnPlayBackPaused()
getApplicationMessenger().HttpApi("broadcastlevel; OnPlayBackPaused;1"); getApplicationMessenger().HttpApi("broadcastlevel; OnPlayBackPaused;1");
#endif #endif


CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile); CVariant param;
param["player"]["speed"] = 0;
param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile, param);
} }


void CApplication::OnPlayBackResumed() void CApplication::OnPlayBackResumed()
Expand All @@ -3914,7 +3917,8 @@ void CApplication::OnPlayBackResumed()
#endif #endif


CVariant param; CVariant param;
param["speed"] = 1; param["player"]["speed"] = 1;
param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
} }


Expand All @@ -3935,8 +3939,9 @@ void CApplication::OnPlayBackSpeedChanged(int iSpeed)
#endif #endif


CVariant param; CVariant param;
param["speed"] = iSpeed; param["player"]["speed"] = iSpeed;
CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
CAnnouncementManager::Announce(Player, "xbmc", "OnSpeedChanged", m_itemCurrentFile, param);
} }


void CApplication::OnPlayBackSeek(int iTime, int seekOffset) void CApplication::OnPlayBackSeek(int iTime, int seekOffset)
Expand All @@ -3956,9 +3961,11 @@ void CApplication::OnPlayBackSeek(int iTime, int seekOffset)
#endif #endif


CVariant param; CVariant param;
param["time"] = iTime; CJSONUtils::MillisecondsToTimeObject(iTime, param["player"]["time"]);
param["seekoffset"] = seekOffset; CJSONUtils::MillisecondsToTimeObject(seekOffset, param["player"]["seekoffset"]);;
CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", param); param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
param["player"]["speed"] = GetPlaySpeed();
CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", m_itemCurrentFile, param);
g_infoManager.SetDisplayAfterSeek(2500, seekOffset/1000); g_infoManager.SetDisplayAfterSeek(2500, seekOffset/1000);
} }


Expand Down Expand Up @@ -4430,7 +4437,8 @@ bool CApplication::OnMessage(CGUIMessage& message)
g_partyModeManager.OnSongChange(true); g_partyModeManager.OnSongChange(true);


CVariant param; CVariant param;
param["speed"] = 1; param["player"]["speed"] = 1;
param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);


DimLCDOnPlayback(true); DimLCDOnPlayback(true);
Expand Down
1 change: 1 addition & 0 deletions xbmc/PlayListPlayer.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define PLAYLIST_NONE -1 #define PLAYLIST_NONE -1
#define PLAYLIST_MUSIC 0 #define PLAYLIST_MUSIC 0
#define PLAYLIST_VIDEO 1 #define PLAYLIST_VIDEO 1
#define PLAYLIST_PICTURE 2


class CFileItem; typedef boost::shared_ptr<CFileItem> CFileItemPtr; class CFileItem; typedef boost::shared_ptr<CFileItem> CFileItemPtr;
class CFileItemList; class CFileItemList;
Expand Down
25 changes: 8 additions & 17 deletions xbmc/interfaces/AnnouncementManager.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -116,35 +116,26 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender,
else if (item->HasMusicInfoTag()) else if (item->HasMusicInfoTag())
{ {
id = item->GetMusicInfoTag()->GetDatabaseId(); id = item->GetMusicInfoTag()->GetDatabaseId();

type = "song";
if (item->IsAlbum())
type = "album";
else
{
type = "song";

if (id <= 0)
{
if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
object["track"] = item->GetMusicInfoTag()->GetTrackNumber();
if (!item->GetMusicInfoTag()->GetAlbum().empty())
object["album"] = item->GetMusicInfoTag()->GetAlbum();
}
}


if (id <= 0) if (id <= 0)
{ {
object["title"] = item->GetMusicInfoTag()->GetTitle(); object["title"] = item->GetMusicInfoTag()->GetTitle();

if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
object["track"] = item->GetMusicInfoTag()->GetTrackNumber();
if (!item->GetMusicInfoTag()->GetAlbum().empty())
object["album"] = item->GetMusicInfoTag()->GetAlbum();
if (!item->GetMusicInfoTag()->GetArtist().empty()) if (!item->GetMusicInfoTag()->GetArtist().empty())
object["artist"] = item->GetMusicInfoTag()->GetArtist(); object["artist"] = item->GetMusicInfoTag()->GetArtist();
} }
} }
else else
type = "unknown"; type = "unknown";


object["type"] = type; object["item"]["type"] = type;
if (id > 0) if (id > 0)
object["id"] = id; object["item"]["id"] = id;


Announce(flag, sender, message, object); Announce(flag, sender, message, object);
} }
195 changes: 0 additions & 195 deletions xbmc/interfaces/json-rpc/AVPlayerOperations.cpp

This file was deleted.

Loading

0 comments on commit c4f161e

Please sign in to comment.