kodi
PlayerOperations.h
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 
9 #pragma once
10 
11 #include "FileItemHandler.h"
12 #include "JSONRPC.h"
13 
14 #include <string>
15 
16 class CVariant;
17 
18 namespace PVR
19 {
20 class CPVRChannelGroup;
21 class CPVREpgInfoTag;
22 }
23 
24 namespace PLAYLIST
25 {
26 using Id = int;
27 enum class RepeatState;
28 } // namespace PLAYLIST
29 
30 namespace JSONRPC
31 {
32  enum PlayerType
33  {
34  None = 0,
35  Video = 0x1,
36  Audio = 0x2,
37  Picture = 0x4,
38  External = 0x8,
39  Remote = 0x10
40  };
41 
42  static const int PlayerImplicit = (Video | Audio | Picture);
43 
45  {
46  public:
47  static JSONRPC_STATUS GetActivePlayers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
48  static JSONRPC_STATUS GetPlayers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
49  static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
50  static JSONRPC_STATUS GetItem(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
51 
52  static JSONRPC_STATUS PlayPause(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
53  static JSONRPC_STATUS Stop(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
54  static JSONRPC_STATUS GetAudioDelay(const std::string& method,
55  ITransportLayer* transport,
56  IClient* client,
57  const CVariant& parameterObject,
58  CVariant& result);
59  static JSONRPC_STATUS SetAudioDelay(const std::string& method,
60  ITransportLayer* transport,
61  IClient* client,
62  const CVariant& parameterObject,
63  CVariant& result);
64  static JSONRPC_STATUS SetSpeed(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
65  static JSONRPC_STATUS SetTempo(const std::string& method,
66  ITransportLayer* transport,
67  IClient* client,
68  const CVariant& parameterObject,
69  CVariant& result);
70  static JSONRPC_STATUS Seek(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
71 
72  static JSONRPC_STATUS Move(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
73  static JSONRPC_STATUS Zoom(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
74  static JSONRPC_STATUS SetViewMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
75  static JSONRPC_STATUS GetViewMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
76  static JSONRPC_STATUS Rotate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
77 
78  static JSONRPC_STATUS Open(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
79  static JSONRPC_STATUS GoTo(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
80  static JSONRPC_STATUS SetShuffle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
81  static JSONRPC_STATUS SetRepeat(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
82  static JSONRPC_STATUS SetPartymode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
83 
84  static JSONRPC_STATUS SetAudioStream(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
85  static JSONRPC_STATUS AddSubtitle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
86  static JSONRPC_STATUS SetSubtitle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
87  static JSONRPC_STATUS SetVideoStream(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
88  private:
89  static int GetActivePlayers();
90  static PlayerType GetPlayer(const CVariant &player);
91  static PLAYLIST::Id GetPlaylist(PlayerType player);
92  static JSONRPC_STATUS StartSlideshow(const std::string& path, bool recursive, bool random, const std::string &firstPicturePath = "");
93  static void SendSlideshowAction(int actionID);
94  static JSONRPC_STATUS GetPropertyValue(PlayerType player, const std::string &property, CVariant &result);
95 
96  static PLAYLIST::RepeatState ParseRepeatState(const CVariant& repeat);
97  static double ParseTimeInSeconds(const CVariant &time);
98  static bool IsPVRChannel();
99  static std::shared_ptr<PVR::CPVREpgInfoTag> GetCurrentEpg();
100  };
101 }
Definition: Application.h:62
Definition: ContextMenuManager.h:24
Definition: AddonsOperations.h:23
Definition: PlayerOperations.h:44
Definition: Variant.h:31
Definition: FileItemHandler.h:25
JSONRPC_STATUS
Possible statuc codes of a response to a JSON-RPC request.
Definition: JSONRPCUtils.h:29
Definition: ITransportLayer.h:27
Definition: IClient.h:13