author | Wei 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) |
commit | 7f696974f1b064584697d91e9d43734d0ba6a19d (patch) | |
tree | 0b6233ec1733fd09a43bd3e71937ec976ee1e03e | |
parent | 1282cd1fdf52c91eceed737def2b3f0d6cbe61ba (diff) | |
download | tv_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
-rw-r--r-- | TvPlay.cpp | 14 | ||||
-rw-r--r-- | TvPlay.h | 2 |
2 files changed, 12 insertions, 4 deletions
@@ -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]; } @@ -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 |