Skip to content

Commit 96a560b

Browse files
committed
AVInput COM-RPC Support: WIP
1 parent 1a7eadf commit 96a560b

File tree

2 files changed

+41
-27
lines changed

2 files changed

+41
-27
lines changed

AVInput/AVInputImplementation.cpp

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,14 @@ namespace Plugin {
552552

553553
return Core::ERROR_NONE;
554554
}
555-
Core::hresult AVInputImplementation::StartInput(const int portId, const int typeOfInput, const bool audioMix, const int planeType, const bool topMost, SuccessResult& successResult)
555+
Core::hresult AVInputImplementation::StartInput(const int portId, const string& typeOfInput, const bool requestAudioMix, const int plane, const bool topMost, SuccessResult& successResult)
556556
{
557557
successResult.success = true;
558558

559559
try {
560-
if (typeOfInput == HDMI) {
561-
device::HdmiInput::getInstance().selectPort(portId, audioMix, planeType, topMost);
562-
} else if (typeOfInput == COMPOSITE) {
560+
if (strcmp(typeOfInput.c_str(), INPUT_TYPE_HDMI) == 0)
561+
device::HdmiInput::getInstance().selectPort(portId, requestAudioMix, plane, topMost);
562+
} else if (strcmp(typeOfInput.c_str(), INPUT_TYPE_COMPOSITE) == 0) {
563563
device::CompositeInput::getInstance().selectPort(portId);
564564
} else {
565565
LOGWARN("Invalid input type passed to StartInput");
@@ -573,7 +573,7 @@ namespace Plugin {
573573
return Core::ERROR_NONE;
574574
}
575575

576-
Core::hresult AVInputImplementation::StopInput(const int typeOfInput, SuccessResult& successResult)
576+
Core::hresult AVInputImplementation::StopInput(const string& typeOfInput, SuccessResult& successResult)
577577
{
578578
Core::hresult ret = Core::ERROR_NONE;
579579
successResult.success = true;
@@ -585,9 +585,9 @@ namespace Plugin {
585585
device::Host::getInstance().setAudioMixerLevels(dsAUDIO_INPUT_SYSTEM, DEFAULT_INPUT_VOL_LEVEL);
586586
isAudioBalanceSet = false;
587587
}
588-
if (typeOfInput == HDMI) {
588+
if (strcmp(typeOfInput.c_str(), INPUT_TYPE_HDMI) == 0) {
589589
device::HdmiInput::getInstance().selectPort(-1);
590-
} else if (typeOfInput == COMPOSITE) {
590+
} else if (strcmp(typeOfInput.c_str(), INPUT_TYPE_COMPOSITE) == 0) {
591591
device::CompositeInput::getInstance().selectPort(-1);
592592
} else {
593593
LOGWARN("Invalid input type passed to StopInput");
@@ -603,12 +603,12 @@ namespace Plugin {
603603
return ret;
604604
}
605605

606-
Core::hresult AVInputImplementation::SetVideoRectangle(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h, const uint16_t typeOfInput, SuccessResult& successResult)
606+
Core::hresult AVInputImplementation::SetVideoRectangle(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h, const string& typeOfInput, SuccessResult& successResult)
607607
{
608608
successResult.success = true;
609609

610610
try {
611-
if (typeOfInput == HDMI) {
611+
if (strcmp(typeOfInput.c_str(), INPUT_TYPE_HDMI) == 0) {
612612
device::HdmiInput::getInstance().scaleVideo(x, y, w, h);
613613
} else {
614614
device::CompositeInput::getInstance().scaleVideo(x, y, w, h);
@@ -620,15 +620,17 @@ namespace Plugin {
620620
return Core::ERROR_NONE;
621621
}
622622

623-
Core::hresult AVInputImplementation::getInputDevices(const int typeOfInput, std::list<WPEFramework::Exchange::IAVInput::InputDevice> &inputDeviceList)
623+
Core::hresult AVInputImplementation::getInputDevices(const string& typeOfInput, std::list<WPEFramework::Exchange::IAVInput::InputDevice> &inputDeviceList)
624624
{
625625
int num = 0;
626+
bool isHdmi = true;
626627

627628
try {
628-
if (typeOfInput == HDMI) {
629+
if (strcmp(typeOfInput.c_str(), INPUT_TYPE_HDMI) == 0) {
629630
num = device::HdmiInput::getInstance().getNumberOfInputs();
630-
} else if (typeOfInput == COMPOSITE) {
631+
} else if (strcmp(typeOfInput.c_str(), INPUT_TYPE_COMPOSITE) == 0) {
631632
num = device::CompositeInput::getInstance().getNumberOfInputs();
633+
isHdmi = false;
632634
} else {
633635
LOGERR("getInputDevices: Invalid input type");
634636
return Core::ERROR_GENERAL;
@@ -642,10 +644,10 @@ namespace Plugin {
642644

643645
inputDevice.id = i;
644646
std::stringstream locator;
645-
if (typeOfInput == HDMI) {
647+
if (isHdmi) {
646648
locator << "hdmiin://localhost/deviceid/" << i;
647649
inputDevice.connected = device::HdmiInput::getInstance().isPortConnected(i);
648-
} else if (typeOfInput == COMPOSITE) {
650+
} else {
649651
locator << "cvbsin://localhost/deviceid/" << i;
650652
inputDevice.connected = device::CompositeInput::getInstance().isPortConnected(i);
651653
}
@@ -662,24 +664,20 @@ namespace Plugin {
662664
return Core::ERROR_NONE;
663665
}
664666

665-
Core::hresult AVInputImplementation::GetInputDevices(const int typeOfInput, IInputDeviceIterator*& devices, bool& success)
667+
Core::hresult AVInputImplementation::GetInputDevices(const string& typeOfInput, IInputDeviceIterator*& devices, bool& success)
666668
{
667669
Core::hresult result;
668670
std::list<WPEFramework::Exchange::IAVInput::InputDevice> inputDeviceList;
669671
success = false;
670672

671-
switch (typeOfInput) {
672-
case ALL: {
673+
if(strcmp(typeOfInput.c_str(), INPUT_TYPE_ALL) == 0) {
673674
result = getInputDevices(HDMI, inputDeviceList);
674675
if (result == Core::ERROR_NONE) {
675676
result = getInputDevices(COMPOSITE, inputDeviceList);
676677
}
677-
}
678-
case HDMI:
679-
case COMPOSITE:
678+
} else if((strcmp(typeOfInput.c_str(), INPUT_TYPE_HDMI) == 0) || (strcmp(typeOfInput.c_str(), INPUT_TYPE_COMPOSITE) == 0)) {
680679
result = getInputDevices(typeOfInput, inputDeviceList);
681-
break;
682-
default:
680+
} else {
683681
LOGERR("GetInputDevices: Invalid input type");
684682
return Core::ERROR_NONE;
685683
}
@@ -742,7 +740,23 @@ namespace Plugin {
742740
IInputDeviceIterator* devices;
743741
bool success;
744742

745-
Core::hresult result = GetInputDevices(type, devices, success);
743+
string typeOfInput;
744+
switch(type) {
745+
case HDMI:
746+
typeOfInput = INPUT_TYPE_HDMI;
747+
break;
748+
case COMPOSITE:
749+
typeOfInput = INPUT_TYPE_COMPOSITE;
750+
break;
751+
case ALL:
752+
typeOfInput = INPUT_TYPE_ALL;
753+
break;
754+
default:
755+
LOGERR("AVInputHotplug: Invalid input type");
756+
return;
757+
}
758+
759+
Core::hresult result = GetInputDevices(typeOfInput, devices, success);
746760
if (Core::ERROR_NONE != result) {
747761
LOGERR("AVInputHotplug [%d, %d, %d]: Failed to get devices", input, connect, type);
748762
return;

AVInput/AVInputImplementation.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ namespace Plugin {
163163
Core::hresult GetVRRSupport(const int portId, bool& vrrSupport) override;
164164
Core::hresult GetHdmiVersion(const int 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 int typeOfInput, const bool audioMix, const int planeType, const bool topMost, SuccessResult& successResult) override;
167-
Core::hresult StopInput(const int typeOfInput, SuccessResult& successResult) override;
168-
Core::hresult SetVideoRectangle(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h, const uint16_t typeOfInput, 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;
167+
Core::hresult StopInput(const string& typeOfInput, SuccessResult& successResult) override;
168+
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;
172172
Core::hresult GetGameFeatureStatus(const int portId, const string& gameFeature, bool& mode, bool& success) override;
173173
Core::hresult GetVRRFrameRate(const int portId, double& currentVRRVideoFrameRate, bool& success) override;
174174

175-
Core::hresult getInputDevices(const int typeOfInput, std::list<WPEFramework::Exchange::IAVInput::InputDevice>& inputDeviceList);
175+
Core::hresult getInputDevices(const string& typeOfInput, std::list<WPEFramework::Exchange::IAVInput::InputDevice>& inputDeviceList);
176176
void AVInputHotplug(int input, int connect, int type);
177177
void AVInputSignalChange(int port, int signalStatus, int type);
178178
void AVInputStatusChange(int port, bool isPresented, int type);

0 commit comments

Comments
 (0)