mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
remotecontrol: formatting code using astyle; some manual code nicenings
Origin commit data
------------------
Branch: ni/coolstream
Commit: b397b7c95f
Author: vanhofen <vanhofen@gmx.de>
Date: 2022-01-25 (Tue, 25 Jan 2022)
Origin message was:
------------------
- remotecontrol: formatting code using astyle; some manual code nicenings
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -92,7 +92,6 @@ t_channel_id CSubService::getChannelID(void) const
|
||||
(uint64_t) CREATE_CHANNEL_ID(service.service_id, service.original_network_id, service.transport_stream_id);
|
||||
}
|
||||
|
||||
|
||||
CRemoteControl::CRemoteControl()
|
||||
{
|
||||
current_channel_id = CZapit::getInstance()->GetCurrentChannelID();;
|
||||
@@ -115,15 +114,16 @@ CRemoteControl::CRemoteControl()
|
||||
has_unresolved_ctags = false;
|
||||
}
|
||||
|
||||
|
||||
int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
{
|
||||
//printf("[neutrino] MSG %x\n", msg);
|
||||
if ( zap_completion_timeout != 0 ) {
|
||||
if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_FAILED ) ||
|
||||
(msg == NeutrinoMessages::EVT_ZAP_ISNVOD )) {
|
||||
if (zap_completion_timeout != 0)
|
||||
{
|
||||
if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_FAILED) || (msg == NeutrinoMessages::EVT_ZAP_ISNVOD))
|
||||
{
|
||||
//printf("[neutrino] timeout EVT_ZAP current %llx data %llx\n", current_channel_id, *(t_channel_id *)data);
|
||||
if ((*(t_channel_id *)data) != current_channel_id) {
|
||||
if ((*(t_channel_id *)data) != current_channel_id)
|
||||
{
|
||||
g_InfoViewer->chanready = 0;
|
||||
if (!IS_WEBCHAN(current_channel_id))
|
||||
g_Sectionsd->setServiceStopped();
|
||||
@@ -134,37 +134,41 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
|
||||
return messages_return::handled;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
zap_completion_timeout = 0;
|
||||
g_InfoViewer->chanready = 1;
|
||||
}
|
||||
/* for CHANGETOLOCKED, we don't need to wait for EPG to arrive... */
|
||||
if ((!is_video_started) &&
|
||||
(g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
// for CHANGETOLOCKED, we don't need to wait for EPG to arrive...
|
||||
if ((!is_video_started) && (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false);
|
||||
|
||||
// check epg fsk in onsignal mode
|
||||
if ((!is_video_started) &&
|
||||
(g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_ONSIGNAL)){
|
||||
if ((!is_video_started) && (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_ONSIGNAL))
|
||||
{
|
||||
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
||||
CEitManager::getInstance()->getCurrentNextServiceKey(current_channel_id, currentNextInfo);
|
||||
if(currentNextInfo.current_fsk && currentNextInfo.current_fsk >= g_settings.parentallock_lockage){
|
||||
if (currentNextInfo.current_fsk && currentNextInfo.current_fsk >= g_settings.parentallock_lockage)
|
||||
{
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_FAILED ) ||
|
||||
(msg == NeutrinoMessages::EVT_ZAP_ISNVOD ))
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_FAILED) || (msg == NeutrinoMessages::EVT_ZAP_ISNVOD))
|
||||
{
|
||||
//printf("[neutrino] EVT_ZAP current %llx data %llx\n", current_channel_id, *(t_channel_id *)data);
|
||||
g_InfoViewer->chanready = 1;
|
||||
// wait for no message from ZAPIT -> someone else has triggered zapping
|
||||
if ((*(t_channel_id *)data) != current_channel_id) {
|
||||
if ((*(t_channel_id *)data) != current_channel_id)
|
||||
{
|
||||
t_channel_id new_id = *(t_channel_id *)data;
|
||||
CZapitChannel *channel = CServiceManager::getInstance()->FindChannel(new_id);
|
||||
is_video_started = true;
|
||||
if (channel) {
|
||||
if (channel)
|
||||
{
|
||||
current_channel_name = channel->getName();
|
||||
current_channel_num = channel->number;
|
||||
if (channel->Locked() != g_settings.parentallock_defaultlocked)
|
||||
@@ -190,18 +194,18 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
if (g_InfoViewer->is_visible)
|
||||
g_RCInput->postMsg(NeutrinoMessages::SHOW_INFOBAR, 0);
|
||||
}
|
||||
if ((!is_video_started) &&
|
||||
(g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
if ((!is_video_started) && (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false);
|
||||
}
|
||||
else
|
||||
if ((msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE) || (msg == NeutrinoMessages:: EVT_ZAP_SUB_FAILED )) {
|
||||
else if ((msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE) || (msg == NeutrinoMessages:: EVT_ZAP_SUB_FAILED))
|
||||
{
|
||||
//printf("[neutrino] EVT_ZAP_SUB current %llx data %llx\n", current_sub_channel_id, *(t_channel_id *)data);
|
||||
if ((*(t_channel_id *)data) != current_sub_channel_id)
|
||||
{
|
||||
current_sub_channel_id = *(t_channel_id *)data;
|
||||
|
||||
for (unsigned int i = 0; i < subChannels.size(); i++)
|
||||
{
|
||||
if (subChannels[i].getChannelID() == (*(t_channel_id *)data))
|
||||
{
|
||||
selected_subchannel = i;
|
||||
@@ -210,11 +214,11 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (msg == NeutrinoMessages::EVT_CURRENTEPG)
|
||||
{
|
||||
if ((*(t_channel_id *)data) != (current_channel_id & 0xFFFFFFFFFFFFULL) &&
|
||||
(*(t_channel_id *)data) != (current_sub_channel_id & 0xFFFFFFFFFFFFULL))
|
||||
if ((*(t_channel_id *)data) != (current_channel_id & 0xFFFFFFFFFFFFULL) && (*(t_channel_id *)data) != (current_sub_channel_id & 0xFFFFFFFFFFFFULL))
|
||||
return messages_return::handled;
|
||||
|
||||
const CSectionsdClient::CurrentNextInfo info_CN = g_InfoViewer->getCurrentNextInfo();
|
||||
@@ -285,17 +289,18 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
}
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE)||
|
||||
(msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE)) {
|
||||
else if ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) || (msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE))
|
||||
{
|
||||
|
||||
if ((*(t_channel_id *)data) == ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) ? current_channel_id : current_sub_channel_id))
|
||||
{
|
||||
CVFD::getInstance()->showServicename(current_channel_name, current_channel_num); // UTF-8
|
||||
CVFD::getInstance()->showServicename(current_channel_name, current_channel_num);
|
||||
g_Zapit->getPIDS(current_PIDs);
|
||||
//tuxtxt
|
||||
#if 1
|
||||
//tuxtxt
|
||||
tuxtxt_stop();
|
||||
if(g_settings.cacheTXT) {
|
||||
if (g_settings.cacheTXT)
|
||||
{
|
||||
printf("TuxTXT pid: %X\n", current_PIDs.PIDs.vtxtpid);
|
||||
if (current_PIDs.PIDs.vtxtpid != 0)
|
||||
tuxtxt_start(current_PIDs.PIDs.vtxtpid);
|
||||
@@ -309,7 +314,8 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
}
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if (msg == NeutrinoMessages::EVT_PMT_CHANGED) {
|
||||
else if (msg == NeutrinoMessages::EVT_PMT_CHANGED)
|
||||
{
|
||||
g_Zapit->getPIDS(current_PIDs);
|
||||
processAPIDnames();
|
||||
return messages_return::unhandled;
|
||||
@@ -345,7 +351,8 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
return messages_return::handled;
|
||||
}
|
||||
#endif
|
||||
else if (msg == NeutrinoMessages::EVT_TUNE_COMPLETE) {
|
||||
else if (msg == NeutrinoMessages::EVT_TUNE_COMPLETE)
|
||||
{
|
||||
t_channel_id chid = *(t_channel_id *)data;
|
||||
printf("CRemoteControl::handleMsg: EVT_TUNE_COMPLETE (%016" PRIx64 ")\n", chid);
|
||||
if (chid && !IS_WEBCHAN(chid))
|
||||
@@ -455,19 +462,23 @@ void CRemoteControl::processAPIDnames()
|
||||
const char *desc;
|
||||
char lang[4];
|
||||
|
||||
if(g_settings.auto_lang && (current_PIDs.APIDs.size() > 1)) {
|
||||
/* first we check prefs to find pid according to pref index */
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < (int) current_PIDs.APIDs.size(); j++) {
|
||||
if (g_settings.auto_lang && (current_PIDs.APIDs.size() > 1))
|
||||
{
|
||||
// first we check prefs to find pid according to pref index
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < (int) current_PIDs.APIDs.size(); j++)
|
||||
{
|
||||
desc = current_PIDs.APIDs[j].desc;
|
||||
// In some cases AAC is the only audio system used
|
||||
// so accept it here as a 'normal' sound track
|
||||
if(strstr(desc, "(AAC)")) {
|
||||
if (strstr(desc, "(AAC)"))
|
||||
{
|
||||
strncpy(lang, desc, 3);
|
||||
lang[3] = 0;
|
||||
desc = lang;
|
||||
}
|
||||
/* processAPIDnames called 2 times, TODO find better way to detect second call */
|
||||
// processAPIDnames called 2 times, TODO find better way to detect second call
|
||||
if (strlen(desc) != 3)
|
||||
continue;
|
||||
if (g_settings.pref_lang[i].empty())
|
||||
@@ -475,25 +486,29 @@ void CRemoteControl::processAPIDnames()
|
||||
|
||||
std::string temp(g_settings.pref_lang[i]);
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
for(it = iso639.begin(); it != iso639.end(); ++it) {
|
||||
if(temp == it->second && strcasecmp(desc, it->first.c_str()) == 0) {
|
||||
/* remember first pref found index and pid*/
|
||||
if(pref_found < 0) {
|
||||
for (it = iso639.begin(); it != iso639.end(); ++it)
|
||||
{
|
||||
if (temp == it->second && strcasecmp(desc, it->first.c_str()) == 0)
|
||||
{
|
||||
// remember first pref found index and pid
|
||||
if (pref_found < 0)
|
||||
{
|
||||
pref_found = j;
|
||||
pref_idx = i;
|
||||
}
|
||||
if ((current_PIDs.APIDs[j].is_ac3 || current_PIDs.APIDs[j].is_eac3)
|
||||
&& g_settings.audio_DolbyDigital && (pref_ac3_found < 0)) {
|
||||
&& g_settings.audio_DolbyDigital && (pref_ac3_found < 0))
|
||||
{
|
||||
pref_ac3_found = j;
|
||||
pref_ac3_idx = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* for all pids */
|
||||
} /*for all prefs*/
|
||||
} // for all pids
|
||||
} // for all prefs
|
||||
|
||||
/* reset pref ac3, if it have lower priority */
|
||||
// reset pref ac3, if it have lower priority
|
||||
if ((pref_idx >= 0) && (pref_idx < pref_ac3_idx))
|
||||
pref_ac3_found = -1;
|
||||
}
|
||||
@@ -545,7 +560,8 @@ void CRemoteControl::processAPIDnames()
|
||||
else if (current_PIDs.APIDs[count].is_lpcm && !strstr(current_PIDs.APIDs[count].desc, " (LPCM)"))
|
||||
tmp_desc += " (LPCM)";
|
||||
|
||||
if(!tmp_desc.empty()){
|
||||
if (!tmp_desc.empty())
|
||||
{
|
||||
strncpy(current_PIDs.APIDs[count].desc, tmp_desc.c_str(), DESC_MAX_LEN - 1);
|
||||
}
|
||||
|
||||
@@ -556,9 +572,11 @@ void CRemoteControl::processAPIDnames()
|
||||
#endif
|
||||
if (has_unresolved_ctags)
|
||||
{
|
||||
if ( current_EPGid == 0 ){
|
||||
if (current_EPGid == 0)
|
||||
{
|
||||
const CSectionsdClient::CurrentNextInfo info_CN = g_InfoViewer->getCurrentNextInfo();
|
||||
if ((info_CN.current_uniqueKey >> 16) == (current_channel_id & 0xFFFFFFFFFFFFULL)){
|
||||
if ((info_CN.current_uniqueKey >> 16) == (current_channel_id & 0xFFFFFFFFFFFFULL))
|
||||
{
|
||||
current_EPGid = info_CN.current_uniqueKey;
|
||||
}
|
||||
}
|
||||
@@ -586,7 +604,8 @@ void CRemoteControl::processAPIDnames()
|
||||
else if (current_PIDs.APIDs[j].is_eac3 && tmp_desc2.find(" (EAC3)"))
|
||||
tmp_desc2 += " (EAC3)";
|
||||
|
||||
if(!tmp_desc2.empty()){
|
||||
if (!tmp_desc2.empty())
|
||||
{
|
||||
strncpy(current_PIDs.APIDs[j].desc, tmp_desc2.c_str(), DESC_MAX_LEN - 1);
|
||||
}
|
||||
}
|
||||
@@ -601,18 +620,22 @@ void CRemoteControl::processAPIDnames()
|
||||
#ifdef APID_DEBUG
|
||||
printf("Neutrino: pref_found %d pref_ac3_found %d ac3_found %d\n", pref_found, pref_ac3_found, ac3_found);
|
||||
#endif
|
||||
if(pref_ac3_found >= 0) {
|
||||
if (pref_ac3_found >= 0)
|
||||
{
|
||||
#ifdef APID_DEBUG
|
||||
printf("Neutrino: set apid name= %s pid= %X\n", current_PIDs.APIDs[pref_ac3_found].desc, current_PIDs.APIDs[pref_ac3_found].pid);
|
||||
#endif
|
||||
setAPID(pref_ac3_found);
|
||||
} else if(pref_found >= 0) {
|
||||
}
|
||||
else if (pref_found >= 0)
|
||||
{
|
||||
#ifdef APID_DEBUG
|
||||
printf("Neutrino: set apid name= %s pid= %X\n", current_PIDs.APIDs[pref_found].desc, current_PIDs.APIDs[pref_found].pid);
|
||||
#endif
|
||||
setAPID(pref_found);
|
||||
}
|
||||
else if(ac3_found >= 0) {
|
||||
else if (ac3_found >= 0)
|
||||
{
|
||||
#ifdef APID_DEBUG
|
||||
printf("Neutrino: set apid name= %s pid= %X\n", current_PIDs.APIDs[ac3_found].desc, current_PIDs.APIDs[ac3_found].pid);
|
||||
#endif
|
||||
@@ -628,7 +651,6 @@ void CRemoteControl::processAPIDnames()
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_GOTAPIDS, (neutrino_msg_data_t)p, false); // data is pointer to allocated memory
|
||||
}
|
||||
|
||||
|
||||
void CRemoteControl::copySubChannelsToZapit(void)
|
||||
{
|
||||
CZapitClient::subServiceList zapitList;
|
||||
@@ -639,7 +661,6 @@ void CRemoteControl::copySubChannelsToZapit(void)
|
||||
g_Zapit->setSubServices(zapitList);
|
||||
}
|
||||
|
||||
|
||||
void CRemoteControl::setAPID(uint32_t APID)
|
||||
{
|
||||
if ((current_PIDs.PIDs.selected_apid == APID) ||
|
||||
@@ -673,7 +694,6 @@ const std::string & CRemoteControl::setSubChannel(const int numSub, const bool f
|
||||
|
||||
const std::string &CRemoteControl::subChannelUp(void)
|
||||
{
|
||||
//return setSubChannel((subChannels.empty()) ? -1 : (int)((selected_subchannel + 1) % subChannels.size()));
|
||||
// if there are any NVOD/subchannels switch these else switch audio channel (if any)
|
||||
if (!subChannels.empty() || !g_settings.audiochannel_up_down_enable)
|
||||
{
|
||||
@@ -691,7 +711,6 @@ const std::string & CRemoteControl::subChannelUp(void)
|
||||
|
||||
const std::string &CRemoteControl::subChannelDown(void)
|
||||
{
|
||||
//return setSubChannel((selected_subchannel <= 0) ? (subChannels.size() - 1) : (selected_subchannel - 1));
|
||||
// if there are any NVOD/subchannels switch these else switch audio channel (if any)
|
||||
if (!subChannels.empty() || !g_settings.audiochannel_up_down_enable)
|
||||
{
|
||||
@@ -710,7 +729,7 @@ const std::string & CRemoteControl::subChannelDown(void)
|
||||
}
|
||||
}
|
||||
|
||||
void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, int channum, const bool start_video) // UTF-8
|
||||
void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string &channame, int channum, const bool start_video)
|
||||
{
|
||||
//printf("zapTo_ChannelID: start_video: %d\n", start_video);
|
||||
if (start_video)
|
||||
@@ -763,7 +782,7 @@ void CRemoteControl::startvideo()
|
||||
{
|
||||
is_video_started = true;
|
||||
//g_Zapit->startPlayBack();
|
||||
g_Zapit->unlockPlayBack(true); /* TODO: check if sendpmt=false is correct in stopvideo() */
|
||||
g_Zapit->unlockPlayBack(true); // TODO: check if sendpmt=false is correct in stopvideo()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,9 +791,9 @@ void CRemoteControl::stopvideo()
|
||||
if (is_video_started)
|
||||
{
|
||||
is_video_started = false;
|
||||
/* we need stopPlayback to blank video,
|
||||
lockPlayback prevents it from being inadvertently starting */
|
||||
// we need stopPlayback to blank video,
|
||||
g_Zapit->stopPlayBack(false);
|
||||
// lockPlayback prevents it from being inadvertently starting
|
||||
g_Zapit->lockPlayBack(false);
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __remotecontrol__
|
||||
#define __remotecontrol__
|
||||
|
||||
@@ -102,7 +101,7 @@ public:
|
||||
bool is_video_started;
|
||||
|
||||
CRemoteControl();
|
||||
void zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, int channum, const bool start_video = true); // UTF-8
|
||||
void zapTo_ChannelID(const t_channel_id channel_id, const std::string &channame, int channum, const bool start_video = true);
|
||||
void startvideo();
|
||||
void stopvideo();
|
||||
void queryAPIDs();
|
||||
@@ -120,5 +119,4 @@ public:
|
||||
inline const int &getCurrentChannelNumber(void) const { return current_channel_num; }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user