Skip to content

Commit b460a42

Browse files
committed
AVInput COM-RPC Support: WIP
1 parent 8931600 commit b460a42

File tree

2 files changed

+147
-32
lines changed

2 files changed

+147
-32
lines changed

AVInput/AVInputImplementation.cpp

Lines changed: 134 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,17 @@ namespace Plugin {
555555
return Core::ERROR_NONE;
556556
}
557557

558-
Core::hresult AVInputImplementation::StartInput(const int portId, const string& typeOfInput, const bool requestAudioMix, const int plane, const bool topMost, SuccessResult& successResult)
558+
Core::hresult AVInputImplementation::StartInput(const string& portId, const string& typeOfInput, const bool requestAudioMix, const int plane, const bool topMost, SuccessResult& successResult)
559559
{
560+
int id;
561+
562+
try {
563+
id = stoi(portId);
564+
} catch (const std::exception& err) {
565+
LOGERR("StartInput: Invalid paramater: portId: %s ", portId);
566+
return Core::ERROR_GENERAL;
567+
}
568+
560569
successResult.success = true;
561570

562571
try {
@@ -693,16 +702,33 @@ namespace Plugin {
693702
return Core::ERROR_NONE;
694703
}
695704

696-
Core::hresult AVInputImplementation::WriteEDID(const int portId, const string& message, SuccessResult& successResult)
705+
Core::hresult AVInputImplementation::WriteEDID(const string& portId, const string& message, SuccessResult& successResult)
697706
{
698-
printf("*** _DEBUG: AVInputImplementation::WriteEDID: entry");
707+
int id;
708+
709+
try {
710+
id = stoi(portId);
711+
} catch (const std::exception& err) {
712+
LOGERR("WriteEDID: Invalid paramater: portId: %s ", portId);
713+
return Core::ERROR_GENERAL;
714+
}
715+
699716
// TODO: This wasn't implemented in the original code, do we want to implement it?
700717
successResult.success = true;
701718
return Core::ERROR_NONE;
702719
}
703720

704-
Core::hresult AVInputImplementation::ReadEDID(const int portId, string& EDID, bool& success)
721+
Core::hresult AVInputImplementation::ReadEDID(const string& portId, string& EDID, bool& success)
705722
{
723+
int id;
724+
725+
try {
726+
id = stoi(portId);
727+
} catch (const std::exception& err) {
728+
LOGERR("ReadEDID: Invalid paramater: portId: %s ", portId);
729+
return Core::ERROR_GENERAL;
730+
}
731+
706732
vector<uint8_t> edidVec({ 'u', 'n', 'k', 'n', 'o', 'w', 'n' });
707733

708734
try {
@@ -1072,9 +1098,17 @@ namespace Plugin {
10721098
return Core::ERROR_NONE;
10731099
}
10741100

1075-
Core::hresult AVInputImplementation::GetGameFeatureStatus(const int portId, const string& gameFeature, bool& mode, bool& success)
1101+
Core::hresult AVInputImplementation::GetGameFeatureStatus(const string& portId, const string& gameFeature, bool& mode, bool& success)
10761102
{
1077-
printf("*** _DEBUG: AVInputImplementation::GetGameFeatureStatus: entry");
1103+
int id;
1104+
1105+
try {
1106+
id = stoi(portId);
1107+
} catch (const std::exception& err) {
1108+
LOGERR("GetGameFeatureStatus: Invalid paramater: portId: %s ", portId);
1109+
return Core::ERROR_GENERAL;
1110+
}
1111+
10781112
if (gameFeature == STR_ALLM) {
10791113
mode = getALLMStatus(portId);
10801114
} else if (gameFeature == VRR_TYPE_HDMI) {
@@ -1129,8 +1163,17 @@ namespace Plugin {
11291163
return ret;
11301164
}
11311165

1132-
Core::hresult AVInputImplementation::GetVRRFrameRate(const int portId, double& currentVRRVideoFrameRate, bool& success)
1166+
Core::hresult AVInputImplementation::GetVRRFrameRate(const string& portId, double& currentVRRVideoFrameRate, bool& success)
11331167
{
1168+
int id;
1169+
1170+
try {
1171+
id = stoi(portId);
1172+
} catch (const std::exception& err) {
1173+
LOGERR("GetVRRFrameRate: Invalid paramater: portId: %s ", portId);
1174+
return Core::ERROR_GENERAL;
1175+
}
1176+
11341177
dsHdmiInVrrStatus_t vrrStatus;
11351178
vrrStatus.vrrAmdfreesyncFramerate_Hz = 0;
11361179

@@ -1143,9 +1186,19 @@ namespace Plugin {
11431186
return Core::ERROR_NONE;
11441187
}
11451188

1146-
Core::hresult AVInputImplementation::GetRawSPD(const int portId, string& HDMISPD, bool& success)
1189+
Core::hresult AVInputImplementation::GetRawSPD(const string& portId, string& HDMISPD, bool& success)
11471190
{
1148-
LOGINFO("AVInputImplementation::getSPDInfo");
1191+
LOGINFO("AVInputImplementation::GetRawSPD");
1192+
1193+
int id;
1194+
1195+
try {
1196+
id = stoi(portId);
1197+
} catch (const std::exception& err) {
1198+
LOGERR("GetRawSPD: Invalid paramater: portId: %s ", portId);
1199+
return Core::ERROR_GENERAL;
1200+
}
1201+
11491202
vector<uint8_t> spdVect({ 'u', 'n', 'k', 'n', 'o', 'w', 'n' });
11501203
HDMISPD.clear();
11511204
try {
@@ -1180,22 +1233,30 @@ namespace Plugin {
11801233
return Core::ERROR_NONE;
11811234
}
11821235

1183-
Core::hresult AVInputImplementation::GetSPD(const int portId, string& HDMISPD, bool& success)
1236+
Core::hresult AVInputImplementation::GetSPD(const string& portId, string& HDMISPD, bool& success)
11841237
{
1238+
int id;
1239+
1240+
try {
1241+
id = stoi(portId);
1242+
} catch (const std::exception& err) {
1243+
LOGERR("GetSPD: Invalid paramater: portId: %s ", portId);
1244+
return Core::ERROR_GENERAL;
1245+
}
1246+
11851247
vector<uint8_t> spdVect({ 'u', 'n', 'k', 'n', 'o', 'w', 'n' });
11861248

1187-
LOGINFO("AVInputImplementation::getSPDInfo");
1249+
LOGINFO("AVInputImplementation::GetSPD");
11881250

11891251
try {
1190-
LOGWARN("AVInputImplementation::getSPDInfo");
11911252
vector<uint8_t> spdVect2;
11921253
device::HdmiInput::getInstance().getHDMISPDInfo(portId, spdVect2);
11931254
spdVect = spdVect2; // edidVec must be "unknown" unless we successfully get to this line
11941255

11951256
// convert to base64
11961257
uint16_t size = min(spdVect.size(), (size_t)numeric_limits<uint16_t>::max());
11971258

1198-
LOGWARN("AVInputImplementation::getSPD size:%d spdVec.size:%zu", size, spdVect.size());
1259+
LOGWARN("AVInputImplementation::GetSPD size:%d spdVec.size:%zu", size, spdVect.size());
11991260

12001261
if (spdVect.size() > (size_t)numeric_limits<uint16_t>::max()) {
12011262
LOGERR("Size too large to use ToString base64 wpe api");
@@ -1243,8 +1304,17 @@ namespace Plugin {
12431304
return Core::ERROR_NONE;
12441305
}
12451306

1246-
Core::hresult AVInputImplementation::SetEdid2AllmSupport(const int portId, const bool allmSupport, SuccessResult& successResult)
1307+
Core::hresult AVInputImplementation::SetEdid2AllmSupport(const string& portId, const bool allmSupport, SuccessResult& successResult)
12471308
{
1309+
int id;
1310+
1311+
try {
1312+
id = stoi(portId);
1313+
} catch (const std::exception& err) {
1314+
LOGERR("SetEdid2AllmSupport: Invalid paramater: portId: %s ", portId);
1315+
return Core::ERROR_GENERAL;
1316+
}
1317+
12481318
successResult.success = true;
12491319

12501320
try {
@@ -1282,8 +1352,17 @@ namespace Plugin {
12821352
return Core::ERROR_NONE;
12831353
}
12841354

1285-
Core::hresult AVInputImplementation::GetVRRSupport(const int portId, bool& vrrSupport)
1355+
Core::hresult AVInputImplementation::GetVRRSupport(const string& portId, bool& vrrSupport)
12861356
{
1357+
int id;
1358+
1359+
try {
1360+
id = stoi(portId);
1361+
} catch (const std::exception& err) {
1362+
LOGERR("GetVRRSupport: Invalid paramater: portId: %s ", portId);
1363+
return Core::ERROR_GENERAL;
1364+
}
1365+
12871366
Core::hresult ret = Core::ERROR_NONE;
12881367

12891368
try {
@@ -1296,8 +1375,17 @@ namespace Plugin {
12961375
return ret;
12971376
}
12981377

1299-
Core::hresult AVInputImplementation::SetVRRSupport(const int portId, const bool vrrSupport)
1378+
Core::hresult AVInputImplementation::SetVRRSupport(const string& portId, const bool vrrSupport)
13001379
{
1380+
int id;
1381+
1382+
try {
1383+
id = stoi(portId);
1384+
} catch (const std::exception& err) {
1385+
LOGERR("SetVRRSupport: Invalid paramater: portId: %s ", portId);
1386+
return Core::ERROR_GENERAL;
1387+
}
1388+
13011389
Core::hresult ret = Core::ERROR_NONE;
13021390
try {
13031391
device::HdmiInput::getInstance().setVRRSupport(portId, vrrSupport);
@@ -1309,8 +1397,17 @@ namespace Plugin {
13091397
return ret;
13101398
}
13111399

1312-
Core::hresult AVInputImplementation::GetHdmiVersion(const int portId, string& HdmiCapabilityVersion, bool& success)
1400+
Core::hresult AVInputImplementation::GetHdmiVersion(const string& portId, string& HdmiCapabilityVersion, bool& success)
13131401
{
1402+
int id;
1403+
1404+
try {
1405+
id = stoi(portId);
1406+
} catch (const std::exception& err) {
1407+
LOGERR("GetHdmiVersion: Invalid paramater: portId: %s ", portId);
1408+
return Core::ERROR_GENERAL;
1409+
}
1410+
13141411
dsHdmiMaxCapabilityVersion_t hdmiCapVersion = HDMI_COMPATIBILITY_VERSION_14;
13151412

13161413
try {
@@ -1347,8 +1444,17 @@ namespace Plugin {
13471444
return Core::ERROR_NONE;
13481445
}
13491446

1350-
Core::hresult AVInputImplementation::SetEdidVersion(const int portId, const string& edidVersion, SuccessResult& successResult)
1447+
Core::hresult AVInputImplementation::SetEdidVersion(const string& portId, const string& edidVersion, SuccessResult& successResult)
13511448
{
1449+
int id;
1450+
1451+
try {
1452+
id = stoi(portId);
1453+
} catch (const std::exception& err) {
1454+
LOGERR("SetEdidVersion: Invalid paramater: portId: %s ", portId);
1455+
return Core::ERROR_GENERAL;
1456+
}
1457+
13521458
int edidVer = -1;
13531459
successResult.success = true;
13541460

@@ -1373,8 +1479,17 @@ namespace Plugin {
13731479
return Core::ERROR_NONE;
13741480
}
13751481

1376-
Core::hresult AVInputImplementation::GetEdidVersion(const int portId, string& edidVersion, bool& success)
1482+
Core::hresult AVInputImplementation::GetEdidVersion(const string& portId, string& edidVersion, bool& success)
13771483
{
1484+
int id;
1485+
1486+
try {
1487+
id = stoi(portId);
1488+
} catch (const std::exception& err) {
1489+
LOGERR("GetEdidVersion: Invalid paramater: portId: %s ", portId);
1490+
return Core::ERROR_GENERAL;
1491+
}
1492+
13781493
success = true;
13791494
int version = -1;
13801495

AVInput/AVInputImplementation.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,26 @@ namespace Plugin {
151151

152152
Core::hresult NumberOfInputs(uint32_t& numberOfInputs, bool& success) override;
153153
Core::hresult GetInputDevices(const string& typeOfInput, Exchange::IAVInput::IInputDeviceIterator*& devices, bool& success);
154-
Core::hresult WriteEDID(const int portId, const string& message, SuccessResult& successResult) override;
155-
Core::hresult ReadEDID(const int portId, string& EDID, bool& success) override;
156-
Core::hresult GetRawSPD(const int portId, string& HDMISPD, bool& success) override;
157-
Core::hresult GetSPD(const int portId, string& HDMISPD, bool& success) override;
158-
Core::hresult SetEdidVersion(const int portId, const string& edidVersion, SuccessResult& successResult) override;
159-
Core::hresult GetEdidVersion(const int portId, string& edidVersion, bool& success) override;
160-
Core::hresult SetEdid2AllmSupport(const int portId, const bool allmSupport, SuccessResult& successResult) override;
154+
Core::hresult WriteEDID(const string& portId, const string& message, SuccessResult& successResult) override;
155+
Core::hresult ReadEDID(const string& portId, string& EDID, bool& success) override;
156+
Core::hresult GetRawSPD(const string& portId, string& HDMISPD, bool& success) override;
157+
Core::hresult GetSPD(const string& portId, string& HDMISPD, bool& success) override;
158+
Core::hresult SetEdidVersion(const string& portId, const string& edidVersion, SuccessResult& successResult) override;
159+
Core::hresult GetEdidVersion(const string& portId, string& edidVersion, bool& success) override;
160+
Core::hresult SetEdid2AllmSupport(const string& portId, const bool allmSupport, SuccessResult& successResult) override;
161161
Core::hresult GetEdid2AllmSupport(const string& portId, bool& allmSupport, bool& success) override;
162-
Core::hresult SetVRRSupport(const int portId, const bool vrrSupport) override;
163-
Core::hresult GetVRRSupport(const int portId, bool& vrrSupport) override;
164-
Core::hresult GetHdmiVersion(const int portId, string& HdmiCapabilityVersion, bool& success) override;
162+
Core::hresult SetVRRSupport(const string& portId, const bool vrrSupport) override;
163+
Core::hresult GetVRRSupport(const string& portId, bool& vrrSupport) override;
164+
Core::hresult GetHdmiVersion(const string& portId, string& HdmiCapabilityVersion, bool& success) override;
165165
Core::hresult SetMixerLevels(const int primaryVolume, const int inputVolume, SuccessResult& successResult) override;
166-
Core::hresult StartInput(const int portId, const string& typeOfInput, const bool requestAudioMix, const int plane, const bool topMost, SuccessResult& successResult) override;
166+
Core::hresult StartInput(const string& portId, const string& typeOfInput, const bool requestAudioMix, const int plane, const bool topMost, SuccessResult& successResult) override;
167167
Core::hresult StopInput(const string& typeOfInput, SuccessResult& successResult) override;
168168
Core::hresult SetVideoRectangle(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h, const string& typeOfInput, SuccessResult& successResult) override;
169169
Core::hresult CurrentVideoMode(string& currentVideoMode, bool& success) override;
170170
Core::hresult ContentProtected(bool& isContentProtected, bool& success) override;
171171
Core::hresult GetSupportedGameFeatures(IStringIterator*& features, bool& success) override;
172-
Core::hresult GetGameFeatureStatus(const int portId, const string& gameFeature, bool& mode, bool& success) override;
173-
Core::hresult GetVRRFrameRate(const int portId, double& currentVRRVideoFrameRate, bool& success) override;
172+
Core::hresult GetGameFeatureStatus(const string& portId, const string& gameFeature, bool& mode, bool& success) override;
173+
Core::hresult GetVRRFrameRate(const string& portId, double& currentVRRVideoFrameRate, bool& success) override;
174174

175175
Core::hresult getInputDevices(const string& typeOfInput, std::list<WPEFramework::Exchange::IAVInput::InputDevice>& inputDeviceList);
176176
void AVInputHotplug(int input, int connect, int type);

0 commit comments

Comments
 (0)