From 7f696974f1b064584697d91e9d43734d0ba6a19d Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 16 Jun 2017 23:47:54 +0000 Subject: pd#145379:use decimal number to mark port_seq in hal Change-Id: I0f180149a98707e32b805fb4312dd8b7d2cbdb48 --- diff --git a/TvPlay.cpp b/TvPlay.cpp index 30b3a0f..4f2f714 100644 --- a/TvPlay.cpp +++ b/TvPlay.cpp @@ -4,6 +4,7 @@ #include #include "TvPlay.h" #include "tvcmd.h" +#include 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 -- cgit