summaryrefslogtreecommitdiff
authorWei Wang <wei.wang@amlogic.com>2017-06-16 23:47:54 (GMT)
committer Wei Wang <wei.wang@amlogic.com>2017-07-05 07:53:46 (GMT)
commit7f696974f1b064584697d91e9d43734d0ba6a19d (patch)
tree0b6233ec1733fd09a43bd3e71937ec976ee1e03e
parent1282cd1fdf52c91eceed737def2b3f0d6cbe61ba (diff)
downloadtv_input-7f696974f1b064584697d91e9d43734d0ba6a19d.zip
tv_input-7f696974f1b064584697d91e9d43734d0ba6a19d.tar.gz
tv_input-7f696974f1b064584697d91e9d43734d0ba6a19d.tar.bz2
pd#145379:use decimal number to mark port_seq in hal
Change-Id: I0f180149a98707e32b805fb4312dd8b7d2cbdb48
Diffstat
-rw-r--r--TvPlay.cpp14
-rw-r--r--TvPlay.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/TvPlay.cpp b/TvPlay.cpp
index 30b3a0f..4f2f714 100644
--- a/TvPlay.cpp
+++ b/TvPlay.cpp
@@ -4,6 +4,7 @@
#include <string.h>
#include "TvPlay.h"
#include "tvcmd.h"
+#include <math.h>
TvPlay::TvPlay()
{
@@ -11,6 +12,14 @@ TvPlay::TvPlay()
tvSession = TvClient::connect();
tvSession->setListener(this);
mHdmiPorts = getHdmiPorts();
+
+ if ( mHdmiPorts >= pow(10, (max_port_num-1)))
+ hdmi_port[3] = mHdmiPorts/pow(10, (max_port_num-1));
+ else
+ hdmi_port[3] = 0;//in this case,there is only 3 hdmi_in ports
+ hdmi_port[2] = (mHdmiPorts -hdmi_port[3]*1000)/100;
+ hdmi_port[1] = (mHdmiPorts -hdmi_port[3]*1000-hdmi_port[2]*100)/10;
+ hdmi_port[0] = mHdmiPorts -hdmi_port[3]*1000-hdmi_port[2]*100-hdmi_port[1]*10;
}
TvPlay::~TvPlay()
@@ -131,9 +140,6 @@ int TvPlay::getHdmiPorts()
}
int TvPlay::getHdmiPort(tv_source_input_t source_input) {
- int max_port_num = 3;
- if ( (source_input - SOURCE_HDMI1) > (max_port_num-1))
- max_port_num = (max_port_num << 1) + 1;
- return mHdmiPorts == 0 ? 0 : max_port_num & (mHdmiPorts >> (2* (source_input - SOURCE_HDMI1)));
+ return mHdmiPorts == 0 ? 0 : hdmi_port[source_input - SOURCE_HDMI1];
}
diff --git a/TvPlay.h b/TvPlay.h
index 335895e..57493d6 100644
--- a/TvPlay.h
+++ b/TvPlay.h
@@ -65,6 +65,8 @@ public:
private:
TvPlayObserver *mpObserver;
int mHdmiPorts;
+ int max_port_num = 4;
+ int hdmi_port[4];// the length of hdmi_port should be equal to max_port_num
};
#ifdef __cplusplus