webtv channels integration port,

initial code (C) martii,
initial patch from jacek
This commit is contained in:
[CST] Focus
2014-08-27 17:32:26 +04:00
parent 415d516465
commit a473fe8194
49 changed files with 1000 additions and 190 deletions

View File

@@ -1077,6 +1077,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
*msg = NeutrinoMessages::EVT_BACK_ZAP_COMPLETE;
*data = (neutrino_msg_data_t) p;
break;
case CZapitClient::EVT_WEBTV_ZAP_COMPLETE:
*msg = NeutrinoMessages::EVT_WEBTV_ZAP_COMPLETE;
*data = (neutrino_msg_data_t) p;
break;
default:
printf("[neutrino] event INITID_ZAPIT - unknown eventID 0x%x\n", emsg.eventID );
}

View File

@@ -937,7 +937,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
printf("%s channel_id %" PRIx64 " epg: %" PRIx64 ", apidmode 0x%X\n", __func__,
eventinfo->channel_id, eventinfo->epgID, eventinfo->apids);
if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF)
if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF || IS_WEBTV(eventinfo->channel_id))
return false;
#if 1 // FIXME test
@@ -1576,18 +1576,19 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend *
/* if allocateFE was successful, full zapTo_serviceID
* needed, if record frontend same as live, and its on different TP */
bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, channel_id);
bool found = (live_fe != frontend) || IS_WEBTV(live_channel_id) || SAME_TRANSPONDER(live_channel_id, channel_id);
/* stop all streams on that fe, if we going to change transponder */
if (!frontend->sameTsidOnid(channel->getTransponderId()))
CStreamManager::getInstance()->StopStream(frontend);
if(found) {
/* stop stream for this channel */
CStreamManager::getInstance()->StopStream(channel_id);
ret = g_Zapit->zapTo_record(channel_id) > 0;
printf("%s found same tp, zapTo_record channel_id %" PRIx64 " result %d\n", __func__, channel_id, ret);
}
else {
printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode());
StopAutoRecord(false);
/* stop all streams */
CStreamManager::getInstance()->StopStream();
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
mode_changed = true;

View File

@@ -85,7 +85,7 @@ void CEpgScan::AddBouquet(CChannelList * clist)
{
for (unsigned i = 0; i < clist->Size(); i++) {
CZapitChannel * chan = clist->getChannelFromIndex(i);
if (scanned.find(chan->getTransponderId()) == scanned.end())
if (!IS_WEBTV(chan->getChannelID()) && scanned.find(chan->getTransponderId()) == scanned.end())
scanmap.insert(eit_scanmap_pair_t(chan->getTransponderId(), chan->getChannelID()));
}
}
@@ -179,10 +179,11 @@ void CEpgScan::AddTransponders()
bool CEpgScan::CheckMode()
{
bool webtv = IS_WEBTV(CZapit::getInstance()->GetCurrentChannelID());
if ((g_settings.epg_scan_mode == CEpgScan::MODE_OFF)
|| (standby && !(g_settings.epg_scan_mode & MODE_STANDBY))
|| (!standby && !(g_settings.epg_scan_mode & MODE_LIVE))
|| (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1))) {
|| (!standby && !webtv && (CFEManager::getInstance()->getEnabledCount() <= 1))) {
return false;
}
return true;
@@ -244,6 +245,11 @@ int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
scan_in_progress = true;
AddTransponders();
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
#if 0
t_channel_id chid = *(t_channel_id *)data;
if (IS_WEBTV(chid))
Next();
#endif
return messages_return::handled;
}
else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) {
@@ -303,7 +309,7 @@ void CEpgScan::EnterStandby()
void CEpgScan::Next()
{
bool locked = false;
bool llocked = false, plocked = false;
next_chid = 0;
@@ -331,13 +337,18 @@ void CEpgScan::Next()
CFrontend *pip_fe = NULL;
#endif
if (!standby) {
locked = true;
live_fe = CZapit::getInstance()->GetLiveFrontend();
CFEManager::getInstance()->lockFrontend(live_fe);
bool webtv = IS_WEBTV(CZapit::getInstance()->GetCurrentChannelID());
if (!webtv) {
llocked = true;
live_fe = CZapit::getInstance()->GetLiveFrontend();
CFEManager::getInstance()->lockFrontend(live_fe);
}
#ifdef ENABLE_PIP
pip_fe = CZapit::getInstance()->GetPipFrontend();
if (pip_fe && pip_fe != live_fe)
if (pip_fe /* && pip_fe != live_fe*/) {
plocked = true;
CFEManager::getInstance()->lockFrontend(pip_fe);
}
#endif
}
_repeat:
@@ -360,13 +371,13 @@ _repeat:
if (!next_chid && ((g_settings.epg_scan == SCAN_SEL) && AddSelected()))
goto _repeat;
if (locked) {
if (llocked)
CFEManager::getInstance()->unlockFrontend(live_fe);
#ifdef ENABLE_PIP
if (pip_fe && pip_fe != live_fe)
CFEManager::getInstance()->unlockFrontend(pip_fe);
if (plocked)
CFEManager::getInstance()->unlockFrontend(pip_fe);
#endif
}
CFEManager::getInstance()->Unlock();
if (next_chid)
g_Zapit->zapTo_epg(next_chid, standby);

View File

@@ -282,7 +282,7 @@ CFrontend * CStreamManager::FindFrontend(CZapitChannel * channel)
t_channel_id chid = channel->getChannelID();
if (CRecordManager::getInstance()->RecordingStatus(chid)) {
printf("CStreamManager::Parse: channel %llx recorded, aborting..\n", chid);
printf("CStreamManager::FindFrontend: channel %llx recorded, aborting..\n", chid);
return frontend;
}
@@ -294,19 +294,22 @@ CFrontend * CStreamManager::FindFrontend(CZapitChannel * channel)
CFEManager::getInstance()->Lock();
bool unlock = true;
CFEManager::getInstance()->lockFrontend(live_fe);
bool unlock = false;
if (!IS_WEBTV(live_channel_id)) {
unlock = true;
CFEManager::getInstance()->lockFrontend(live_fe);
}
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it)
frontends.insert(it->second->frontend);
frontends.insert(it->second->frontend);
for (std::set<CFrontend*>::iterator ft = frontends.begin(); ft != frontends.end(); ft++)
CFEManager::getInstance()->lockFrontend(*ft);
frontend = CFEManager::getInstance()->allocateFE(channel, true);
if (frontend == NULL) {
if (unlock && frontend == NULL) {
unlock = false;
CFEManager::getInstance()->unlockFrontend(live_fe);
frontend = CFEManager::getInstance()->allocateFE(channel, true);
@@ -315,7 +318,7 @@ CFrontend * CStreamManager::FindFrontend(CZapitChannel * channel)
CFEManager::getInstance()->Unlock();
if (frontend) {
bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, chid);
bool found = (live_fe != frontend) || IS_WEBTV(live_channel_id) || SAME_TRANSPONDER(live_channel_id, chid);
bool ret = false;
if (found)
ret = zapit.zapTo_record(chid) > 0;
@@ -410,6 +413,8 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFro
return false;
printf("CStreamManager::Parse: channel_id %llx [%s]\n", chid, channel->getName().c_str());
if (IS_WEBTV(chid))
return false;
frontend = FindFrontend(channel);
if (!frontend) {
@@ -436,13 +441,13 @@ void CStreamManager::AddPids(int fd, CZapitChannel *channel, stream_pids_t &pids
CGenPsi psi;
for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) {
if (*it == channel->getVideoPid()) {
printf("CStreamManager::Parse: genpsi vpid %x (%d)\n", *it, channel->type);
printf("CStreamManager::AddPids: genpsi vpid %x (%d)\n", *it, channel->type);
psi.addPid(*it, channel->type == 1 ? EN_TYPE_AVC : channel->type == 2 ? EN_TYPE_HEVC : EN_TYPE_VIDEO, 0);
} else {
for (int i = 0; i < channel->getAudioChannelCount(); i++) {
if (*it == channel->getAudioChannel(i)->pid) {
CZapitAudioChannel::ZapitAudioChannelType atype = channel->getAudioChannel(i)->audioChannelType;
printf("CStreamManager::Parse: genpsi apid %x (%d)\n", *it, atype);
printf("CStreamManager::AddPids: genpsi apid %x (%d)\n", *it, atype);
if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) {
psi.addPid(*it, EN_TYPE_AUDIO_EAC3, atype, channel->getAudioChannel(i)->description.c_str());
} else {
@@ -622,6 +627,21 @@ bool CStreamManager::StopStream(t_channel_id channel_id)
return ret;
}
bool CStreamManager::StopStream(CFrontend * fe)
{
bool ret = false;
for (streammap_iterator_t it = streams.begin(); it != streams.end(); ) {
if (it->second->frontend == fe) {
delete it->second;
streams.erase(it++);
ret = true;
} else {
++it;
}
}
return ret;
}
bool CStreamManager::StreamStatus(t_channel_id channel_id)
{
bool ret;

View File

@@ -96,6 +96,7 @@ class CStreamManager : public OpenThreads::Thread
bool Start(int port = 0);
bool Stop();
bool StopStream(t_channel_id channel_id = 0);
bool StopStream(CFrontend * fe);
bool StreamStatus(t_channel_id channel_id = 0);
bool SetPort(int newport);
int GetPort() { return port; }

View File

@@ -351,13 +351,13 @@ void CVFD::showRCLock(int /*duration*/)
{
}
void CVFD::showVolume(const char vol, const bool /*perform_update*/)
void CVFD::showVolume(const char vol, const bool force_update)
{
static int oldpp = 0;
if(!has_lcd) return;
ShowIcon(FP_ICON_MUTE, muted);
if(vol == volume)
if(!force_update && vol == volume)
return;
volume = vol;
@@ -368,7 +368,7 @@ void CVFD::showVolume(const char vol, const bool /*perform_update*/)
int pp = (int) round((double) vol * (double) 8 / (double) 100);
if(pp > 8) pp = 8;
if(oldpp != pp) {
if(force_update || oldpp != pp) {
printf("CVFD::showVolume: %d, bar %d\n", (int) vol, pp);
int i;
int j = 0x00000200;