mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
neutrino: various fixes and ports from the original
* avoid ambiguities in new and delete by always allocating char[] * get rid of unused next_program_timer * reduce code differences to original, known good neutrino code
This commit is contained in:
@@ -106,7 +106,7 @@ CRemoteControl::CRemoteControl()
|
||||
selected_subchannel = -1;
|
||||
needs_nvods = false;
|
||||
director_mode = 0;
|
||||
current_programm_timer = 0;
|
||||
// current_programm_timer = 0;
|
||||
is_video_started = true;
|
||||
}
|
||||
|
||||
@@ -194,19 +194,19 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
}
|
||||
}
|
||||
|
||||
if ( msg == NeutrinoMessages::EVT_CURRENTEPG ) {
|
||||
CSectionsdClient::CurrentNextInfo* info_CN = (CSectionsdClient::CurrentNextInfo*) data;
|
||||
if ( msg == NeutrinoMessages::EVT_CURRENTEPG )
|
||||
{
|
||||
if ((*(t_channel_id *)data) != (current_channel_id & 0xFFFFFFFFFFFFULL) &&
|
||||
(*(t_channel_id *)data) != (current_sub_channel_id & 0xFFFFFFFFFFFFULL))
|
||||
return messages_return::handled;
|
||||
|
||||
//printf("[neutrino] got EVT_CURRENTEPG, uniqueKey %llx chid %llx flags %x\n", info_CN->current_uniqueKey, current_channel_id, info_CN->flags);
|
||||
//printf("[neutrino] comparing: uniqueKey %llx chid %llx\n", info_CN->current_uniqueKey >> 16, current_channel_id & 0xFFFFFFFFFFFFULL);
|
||||
if ( ( info_CN->current_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL))
|
||||
const CSectionsdClient::CurrentNextInfo info_CN = g_InfoViewer->getCurrentNextInfo();
|
||||
if ((info_CN.current_uniqueKey >> 16) == (current_channel_id & 0xFFFFFFFFFFFFULL) || (info_CN.current_uniqueKey >> 16) == (current_sub_channel_id & 0xFFFFFFFFFFFFULL))
|
||||
{
|
||||
//printf("[neutrino] channel match\n");
|
||||
//CURRENT-EPG f<>r den aktuellen Kanal bekommen!;
|
||||
CVFD::getInstance()->setEPGTitle(info_CN->current_name);
|
||||
if ( info_CN->current_uniqueKey != current_EPGid )
|
||||
//CURRENT-EPG for current channel arrived!;
|
||||
CVFD::getInstance()->setEPGTitle(info_CN.current_name);
|
||||
if (info_CN.current_uniqueKey != current_EPGid)
|
||||
{
|
||||
//printf("[neutrino] info_CN->current_uniqueKey != current_EPGid\n");
|
||||
if ( current_EPGid != 0 )
|
||||
{
|
||||
// ist nur ein neues Programm, kein neuer Kanal
|
||||
@@ -218,58 +218,45 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
g_InfoViewer->showEpgInfo();
|
||||
}
|
||||
|
||||
current_EPGid= info_CN->current_uniqueKey;
|
||||
current_EPGid = info_CN.current_uniqueKey;
|
||||
|
||||
if ( has_unresolved_ctags )
|
||||
processAPIDnames();
|
||||
|
||||
if ( info_CN->flags & CSectionsdClient::epgflags::current_has_linkagedescriptors ) {
|
||||
//printf("[neutrino] info_CN->flags have current_has_linkaged\n");
|
||||
if (selected_subchannel <= 0 && info_CN.flags & CSectionsdClient::epgflags::current_has_linkagedescriptors)
|
||||
{
|
||||
subChannels.clear();
|
||||
getSubChannels();
|
||||
}
|
||||
|
||||
if ( needs_nvods )
|
||||
getNVODs();
|
||||
|
||||
g_RCInput->killTimer( current_programm_timer );
|
||||
|
||||
time_t end_program= info_CN->current_zeit.startzeit+ info_CN->current_zeit.dauer;
|
||||
current_programm_timer = g_RCInput->addTimer( &end_program );
|
||||
}
|
||||
|
||||
// is_video_started is only false if channel is locked
|
||||
if ((!is_video_started) &&
|
||||
(info_CN->current_fsk == 0 || g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
(info_CN.current_fsk == 0 || g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false);
|
||||
else
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, info_CN->current_fsk, false);
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, info_CN.current_fsk, false);
|
||||
}
|
||||
return messages_return::handled;
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if ( msg == NeutrinoMessages::EVT_NEXTEPG )
|
||||
{
|
||||
CSectionsdClient::CurrentNextInfo* info_CN = (CSectionsdClient::CurrentNextInfo*) data;
|
||||
if ((*(t_channel_id *)data) != current_channel_id)
|
||||
return messages_return::handled;
|
||||
|
||||
if ( ( info_CN->next_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL) )
|
||||
const CSectionsdClient::CurrentNextInfo info_CN = g_InfoViewer->getCurrentNextInfo();
|
||||
if ((info_CN.next_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL) )
|
||||
{
|
||||
// next-EPG f<EFBFBD>r den aktuellen Kanal bekommen, current ist leider net da?!;
|
||||
if ( info_CN->next_uniqueKey != next_EPGid )
|
||||
{
|
||||
next_EPGid= info_CN->next_uniqueKey;
|
||||
|
||||
// timer setzen
|
||||
|
||||
g_RCInput->killTimer( current_programm_timer );
|
||||
|
||||
time_t end_program= info_CN->next_zeit.startzeit;
|
||||
current_programm_timer = g_RCInput->addTimer( &end_program );
|
||||
}
|
||||
// next-EPG for current channel arrived. no current-EPG?!
|
||||
if (info_CN.next_uniqueKey != next_EPGid)
|
||||
next_EPGid = info_CN.next_uniqueKey;
|
||||
}
|
||||
if ( !is_video_started )
|
||||
g_RCInput->postMsg( NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false );
|
||||
|
||||
return messages_return::handled;
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if (msg == NeutrinoMessages::EVT_NOEPG_YET)
|
||||
{
|
||||
@@ -298,8 +285,8 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
tuxtxt_start(current_PIDs.PIDs.vtxtpid);
|
||||
}
|
||||
#endif
|
||||
t_channel_id * p = new t_channel_id;
|
||||
*p = current_channel_id;
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, ¤t_channel_id, sizeof(t_channel_id));
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_GOTPIDS, (const neutrino_msg_data_t)p, false);
|
||||
|
||||
processAPIDnames();
|
||||
@@ -330,6 +317,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
}
|
||||
return messages_return::handled;
|
||||
}
|
||||
#if 0
|
||||
else if ( ( msg == NeutrinoMessages::EVT_TIMER ) && ( data == current_programm_timer ) )
|
||||
{
|
||||
//printf("new program !\n");
|
||||
@@ -340,6 +328,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
||||
|
||||
return messages_return::handled;
|
||||
}
|
||||
#endif
|
||||
//else if (msg == NeutrinoMessages::EVT_ZAP_FAILED || msg == NeutrinoMessages::EVT_ZAP_SUB_FAILED)
|
||||
//return messages_return::handled;
|
||||
else
|
||||
@@ -372,8 +361,8 @@ void CRemoteControl::getSubChannels()
|
||||
}
|
||||
copySubChannelsToZapit();
|
||||
|
||||
t_channel_id * p = new t_channel_id;
|
||||
*p = current_channel_id;
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, ¤t_channel_id, sizeof(t_channel_id));
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES, (const neutrino_msg_data_t)p, false); // data is pointer to allocated memory
|
||||
}
|
||||
}
|
||||
@@ -415,8 +404,8 @@ void CRemoteControl::getNVODs()
|
||||
|
||||
copySubChannelsToZapit();
|
||||
|
||||
t_channel_id * p = new t_channel_id;
|
||||
*p = current_channel_id;
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, ¤t_channel_id, sizeof(t_channel_id));
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES, (const neutrino_msg_data_t)p, false); // data is pointer to allocated memory
|
||||
|
||||
if ( selected_subchannel == -1 )
|
||||
@@ -562,8 +551,8 @@ void CRemoteControl::processAPIDnames()
|
||||
setAPID( 0 );
|
||||
}
|
||||
|
||||
t_channel_id * p = new t_channel_id;
|
||||
*p = current_channel_id;
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, ¤t_channel_id, sizeof(t_channel_id));
|
||||
g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_GOTAPIDS, (const neutrino_msg_data_t)p, false); // data is pointer to allocated memory
|
||||
}
|
||||
|
||||
@@ -689,7 +678,7 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s
|
||||
g_Sectionsd->setServiceChanged( current_channel_id&0xFFFFFFFFFFFFULL, false );
|
||||
|
||||
zap_completion_timeout = now + 2 * (int64_t) 1000000;
|
||||
g_RCInput->killTimer( current_programm_timer );
|
||||
// g_RCInput->killTimer( current_programm_timer );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,7 @@ typedef std::vector<CSubService> CSubServiceListSorted;
|
||||
|
||||
class CRemoteControl
|
||||
{
|
||||
unsigned int current_programm_timer;
|
||||
// unsigned int current_programm_timer;
|
||||
uint64_t zap_completion_timeout;
|
||||
std::string current_channel_name;
|
||||
t_channel_id current_sub_channel_id;
|
||||
|
@@ -4,6 +4,9 @@
|
||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||
Homepage: http://dbox.cyberphoria.org/
|
||||
|
||||
Bugfixes/cleanups (C) 2007-2012 Stefan Seyfried
|
||||
(C) 2008 Novell, Inc. Author: Stefan Seyfried
|
||||
|
||||
Kommentar:
|
||||
|
||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
||||
@@ -1501,43 +1504,45 @@ void CInfoViewer::showButton_SubServices ()
|
||||
}
|
||||
}
|
||||
|
||||
CSectionsdClient::CurrentNextInfo CInfoViewer::getEPG (const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info)
|
||||
void CInfoViewer::getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info)
|
||||
{
|
||||
static CSectionsdClient::CurrentNextInfo oldinfo;
|
||||
|
||||
//g_Sectionsd->getCurrentNextServiceKey (for_channel_id & 0xFFFFFFFFFFFFULL, info);
|
||||
sectionsd_getCurrentNextServiceKey(for_channel_id & 0xFFFFFFFFFFFFULL, info);
|
||||
/* to clear the oldinfo for channels without epg, call getEPG() with for_channel_id = 0 */
|
||||
if (for_channel_id == 0)
|
||||
{
|
||||
oldinfo.current_uniqueKey = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//printf("CInfoViewer::getEPG: old uniqueKey %llx new %llx\n", oldinfo.current_uniqueKey, info.current_uniqueKey);
|
||||
sectionsd_getCurrentNextServiceKey(for_channel_id & 0xFFFFFFFFFFFFULL, info);
|
||||
|
||||
/* of there is no EPG, send an event so that parental lock can work */
|
||||
if (info.current_uniqueKey == 0 && info.next_uniqueKey == 0) {
|
||||
oldinfo = info;
|
||||
t_channel_id *p = new t_channel_id;
|
||||
*p = for_channel_id;
|
||||
memcpy(&oldinfo, &info, sizeof(CSectionsdClient::CurrentNextInfo));
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, &for_channel_id, sizeof(t_channel_id));
|
||||
g_RCInput->postMsg (NeutrinoMessages::EVT_NOEPG_YET, (const neutrino_msg_data_t) p, false);
|
||||
return info;
|
||||
return;
|
||||
}
|
||||
|
||||
if (info.current_uniqueKey != oldinfo.current_uniqueKey || info.next_uniqueKey != oldinfo.next_uniqueKey) {
|
||||
if (info.flags & (CSectionsdClient::epgflags::has_current | CSectionsdClient::epgflags::has_next)) {
|
||||
CSectionsdClient::CurrentNextInfo * _info = new CSectionsdClient::CurrentNextInfo;
|
||||
*_info = info;
|
||||
neutrino_msg_t msg;
|
||||
if (info.current_uniqueKey != oldinfo.current_uniqueKey || info.next_uniqueKey != oldinfo.next_uniqueKey)
|
||||
{
|
||||
char *p = new char[sizeof(t_channel_id)];
|
||||
memcpy(p, &for_channel_id, sizeof(t_channel_id));
|
||||
neutrino_msg_t msg;
|
||||
if (info.flags & (CSectionsdClient::epgflags::has_current | CSectionsdClient::epgflags::has_next))
|
||||
{
|
||||
if (info.flags & CSectionsdClient::epgflags::has_current)
|
||||
msg = NeutrinoMessages::EVT_CURRENTEPG;
|
||||
else
|
||||
msg = NeutrinoMessages::EVT_NEXTEPG;
|
||||
g_RCInput->postMsg(msg, (unsigned) _info, false );
|
||||
} else {
|
||||
t_channel_id *p = new t_channel_id;
|
||||
*p = for_channel_id;
|
||||
g_RCInput->postMsg (NeutrinoMessages::EVT_NOEPG_YET, (const neutrino_msg_data_t) p, false); // data is pointer to allocated memory
|
||||
}
|
||||
oldinfo = info;
|
||||
else
|
||||
msg = NeutrinoMessages::EVT_NOEPG_YET;
|
||||
g_RCInput->postMsg(msg, (const neutrino_msg_data_t)p, false); // data is pointer to allocated memory
|
||||
memcpy(&oldinfo, &info, sizeof(CSectionsdClient::CurrentNextInfo));
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void CInfoViewer::showSNR ()
|
||||
|
@@ -177,7 +177,8 @@ class CInfoViewer
|
||||
void showTitle(const int ChanNum, const std::string & Channel, const t_satellite_position satellitePosition, const t_channel_id new_channel_id = 0, const bool calledFromNumZap = false, int epgpos = 0); // Channel must be UTF-8 encoded
|
||||
void lookAheadEPG(const int ChanNum, const std::string & Channel, const t_channel_id new_channel_id = 0, const bool calledFromNumZap = false); //alpha: fix for nvod subchannel update
|
||||
void killTitle();
|
||||
CSectionsdClient::CurrentNextInfo getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info);
|
||||
void getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info);
|
||||
CSectionsdClient::CurrentNextInfo getCurrentNextInfo() const { return info_CurrentNext; }
|
||||
|
||||
void showSubchan();
|
||||
void Set_CA_Status(int Status);
|
||||
|
@@ -2311,7 +2311,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
||||
|
||||
if( res != messages_return::unhandled ) {
|
||||
if( ( msg>= CRCInput::RC_WithData ) && ( msg< CRCInput::RC_WithData+ 0x10000000 ) )
|
||||
delete (unsigned char*) data;
|
||||
delete[] (unsigned char*) data;
|
||||
return( res & ( 0xFFFFFFFF - messages_return::unhandled ) );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user