Skip to content

Commit

Permalink
[json]: - added Player.ViewMode method to the json interface and bump…
Browse files Browse the repository at this point in the history
… json api version to 10.2.0
  • Loading branch information
Memphiz committed Feb 10, 2019
1 parent 1c60cbd commit 46f018e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
Expand Up @@ -58,6 +58,7 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = {
{ "Player.Seek", CPlayerOperations::Seek },
{ "Player.Move", CPlayerOperations::Move },
{ "Player.Zoom", CPlayerOperations::Zoom },
{ "Player.ViewMode", CPlayerOperations::ViewMode },
{ "Player.Rotate", CPlayerOperations::Rotate },

{ "Player.Open", CPlayerOperations::Open },
Expand Down
24 changes: 24 additions & 0 deletions xbmc/interfaces/json-rpc/PlayerOperations.cpp
Expand Up @@ -489,6 +489,30 @@ JSONRPC_STATUS CPlayerOperations::Zoom(const std::string &method, ITransportLaye
}
}

JSONRPC_STATUS CPlayerOperations::ViewMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
CVariant viewMode = parameterObject["viewmode"];
CVariant zoom = parameterObject["zoom"];
CVariant pixelRatio = parameterObject["pixelratio"];
CVariant verticalShift = parameterObject["verticalshift"];
CVariant stretch = parameterObject["nonlinearstretch"];

if (viewMode.isInteger() &&
zoom.isDouble() &&
pixelRatio.isDouble() &&
verticalShift.isDouble() &&
stretch.isBoolean())
{
g_application.GetAppPlayer().SetRenderViewMode(static_cast<int>(viewMode.asInteger()),
zoom.asDouble(),
pixelRatio.asDouble(),
verticalShift.asDouble(),
stretch.asBoolean());
return ACK;
}
return InvalidParams;
}

JSONRPC_STATUS CPlayerOperations::Rotate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
switch (GetPlayer(parameterObject["playerid"]))
Expand Down
1 change: 1 addition & 0 deletions xbmc/interfaces/json-rpc/PlayerOperations.h
Expand Up @@ -45,6 +45,7 @@ namespace JSONRPC

static JSONRPC_STATUS Move(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS Zoom(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS ViewMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS Rotate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);

static JSONRPC_STATUS Open(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
Expand Down
14 changes: 14 additions & 0 deletions xbmc/interfaces/json-rpc/schema/methods.json
Expand Up @@ -335,6 +335,20 @@
],
"returns": "string"
},
"Player.ViewMode": {
"type": "method",
"description": "ViewMode of VideoPlayer",
"transport": "Response",
"permission": "ControlPlayback",
"params": [
{ "name": "viewmode", "type": "integer", "description": "view mode numbers", "required": true },
{ "name": "zoom", "type": "number", "required": "false", "default": 1.0, "description": "Zoom were 1.0 means 100%" },
{ "name": "pixelratio", "type": "number", "required": "false", "default": 1.0, "description": "Pixel aspect ratio were 1.0 means square pixel" },
{ "name": "verticalshift", "type": "number", "required": "false", "default": 0.0, "description": "Verticalshift 1.0 means shift to bottom" },
{ "name": "nonlinearstretch", "type": "boolean", "required": "false", "default": false, "description": "Flag to enable nonlinear stretch" }
],
"returns": "string"
},
"Player.Rotate": {
"type": "method",
"description": "Rotates current picture",
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/schema/version.txt
@@ -1 +1 @@
JSONRPC_VERSION 10.1.2
JSONRPC_VERSION 10.2.0

0 comments on commit 46f018e

Please sign in to comment.