@@ -552,14 +552,14 @@ namespace Plugin {
552
552
553
553
return Core::ERROR_NONE;
554
554
}
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)
556
556
{
557
557
successResult.success = true ;
558
558
559
559
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 ) {
563
563
device::CompositeInput::getInstance ().selectPort (portId);
564
564
} else {
565
565
LOGWARN (" Invalid input type passed to StartInput" );
@@ -573,7 +573,7 @@ namespace Plugin {
573
573
return Core::ERROR_NONE;
574
574
}
575
575
576
- Core::hresult AVInputImplementation::StopInput (const int typeOfInput, SuccessResult& successResult)
576
+ Core::hresult AVInputImplementation::StopInput (const string& typeOfInput, SuccessResult& successResult)
577
577
{
578
578
Core::hresult ret = Core::ERROR_NONE;
579
579
successResult.success = true ;
@@ -585,9 +585,9 @@ namespace Plugin {
585
585
device::Host::getInstance ().setAudioMixerLevels (dsAUDIO_INPUT_SYSTEM, DEFAULT_INPUT_VOL_LEVEL);
586
586
isAudioBalanceSet = false ;
587
587
}
588
- if (typeOfInput == HDMI ) {
588
+ if (strcmp ( typeOfInput. c_str (), INPUT_TYPE_HDMI) == 0 ) {
589
589
device::HdmiInput::getInstance ().selectPort (-1 );
590
- } else if (typeOfInput == COMPOSITE ) {
590
+ } else if (strcmp ( typeOfInput. c_str (), INPUT_TYPE_COMPOSITE) == 0 ) {
591
591
device::CompositeInput::getInstance ().selectPort (-1 );
592
592
} else {
593
593
LOGWARN (" Invalid input type passed to StopInput" );
@@ -603,12 +603,12 @@ namespace Plugin {
603
603
return ret;
604
604
}
605
605
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)
607
607
{
608
608
successResult.success = true ;
609
609
610
610
try {
611
- if (typeOfInput == HDMI ) {
611
+ if (strcmp ( typeOfInput. c_str (), INPUT_TYPE_HDMI) == 0 ) {
612
612
device::HdmiInput::getInstance ().scaleVideo (x, y, w, h);
613
613
} else {
614
614
device::CompositeInput::getInstance ().scaleVideo (x, y, w, h);
@@ -620,15 +620,17 @@ namespace Plugin {
620
620
return Core::ERROR_NONE;
621
621
}
622
622
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)
624
624
{
625
625
int num = 0 ;
626
+ bool isHdmi = true ;
626
627
627
628
try {
628
- if (typeOfInput == HDMI ) {
629
+ if (strcmp ( typeOfInput. c_str (), INPUT_TYPE_HDMI) == 0 ) {
629
630
num = device::HdmiInput::getInstance ().getNumberOfInputs ();
630
- } else if (typeOfInput == COMPOSITE ) {
631
+ } else if (strcmp ( typeOfInput. c_str (), INPUT_TYPE_COMPOSITE) == 0 ) {
631
632
num = device::CompositeInput::getInstance ().getNumberOfInputs ();
633
+ isHdmi = false ;
632
634
} else {
633
635
LOGERR (" getInputDevices: Invalid input type" );
634
636
return Core::ERROR_GENERAL;
@@ -642,10 +644,10 @@ namespace Plugin {
642
644
643
645
inputDevice.id = i;
644
646
std::stringstream locator;
645
- if (typeOfInput == HDMI ) {
647
+ if (isHdmi ) {
646
648
locator << " hdmiin://localhost/deviceid/" << i;
647
649
inputDevice.connected = device::HdmiInput::getInstance ().isPortConnected (i);
648
- } else if (typeOfInput == COMPOSITE) {
650
+ } else {
649
651
locator << " cvbsin://localhost/deviceid/" << i;
650
652
inputDevice.connected = device::CompositeInput::getInstance ().isPortConnected (i);
651
653
}
@@ -662,24 +664,20 @@ namespace Plugin {
662
664
return Core::ERROR_NONE;
663
665
}
664
666
665
- Core::hresult AVInputImplementation::GetInputDevices (const int typeOfInput, IInputDeviceIterator*& devices, bool & success)
667
+ Core::hresult AVInputImplementation::GetInputDevices (const string& typeOfInput, IInputDeviceIterator*& devices, bool & success)
666
668
{
667
669
Core::hresult result;
668
670
std::list<WPEFramework::Exchange::IAVInput::InputDevice> inputDeviceList;
669
671
success = false ;
670
672
671
- switch (typeOfInput) {
672
- case ALL: {
673
+ if (strcmp (typeOfInput.c_str (), INPUT_TYPE_ALL) == 0 ) {
673
674
result = getInputDevices (HDMI, inputDeviceList);
674
675
if (result == Core::ERROR_NONE) {
675
676
result = getInputDevices (COMPOSITE, inputDeviceList);
676
677
}
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 )) {
680
679
result = getInputDevices (typeOfInput, inputDeviceList);
681
- break ;
682
- default :
680
+ } else {
683
681
LOGERR (" GetInputDevices: Invalid input type" );
684
682
return Core::ERROR_NONE;
685
683
}
@@ -742,7 +740,23 @@ namespace Plugin {
742
740
IInputDeviceIterator* devices;
743
741
bool success;
744
742
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);
746
760
if (Core::ERROR_NONE != result) {
747
761
LOGERR (" AVInputHotplug [%d, %d, %d]: Failed to get devices" , input, connect, type);
748
762
return ;
0 commit comments