コード例 #1
0
//-------------------------------------------------------------------------
// y-func : get_channel_dropdown [<bouquet_nr> [<channel_id>]]
//-------------------------------------------------------------------------
std::string  CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, std::string para)
{
	std::string abouquet, achannel_id, yresult, sel;

	int bnumber = 1;
	int mode = NeutrinoAPI->Zapit->getMode();

	ySplitString(para," ",abouquet, achannel_id);
	if(!abouquet.empty())
		bnumber = atoi(abouquet.c_str());
	if(bnumber > 0) {
		bnumber--;
		ZapitChannelList channels;
		//channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[bnumber]->radioChannels : g_bouquetManager->Bouquets[bnumber]->tvChannels;
		if (mode == CZapitClient::MODE_RADIO)
			g_bouquetManager->Bouquets[bnumber]->getRadioChannels(channels);
		else
			g_bouquetManager->Bouquets[bnumber]->getTvChannels(channels);
		for(int j = 0; j < (int) channels.size(); j++) {
			CEPGData epg;
			CZapitChannel * channel = channels[j];
			char buf[100],id[20];
			snprintf(id,sizeof(id),PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->getChannelID());
			std::string _sid = std::string(id);
			sel = (_sid == achannel_id) ? "selected=\"selected\"" : "";
			CEitManager::getInstance()->getActualEPGServiceKey(channel->getChannelID(), &epg);
			snprintf(buf,sizeof(buf),"<option value=" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s>%.20s - %.30s</option>\n", channel->getChannelID(), sel.c_str(), channel->getName().c_str(),epg.title.c_str());
			yresult += buf;
		}
	}
	return yresult;
}
コード例 #2
0
ファイル: bouquets.cpp プロジェクト: Firmeware/max-tdt
void CBouquetManager::parseBouquetsXml(const xmlNodePtr root, bool bUser)
{
	xmlNodePtr search=root->xmlChildrenNode;
	xmlNodePtr channel_node;

	if (search) {
		t_original_network_id original_network_id;
		t_service_id service_id;
		t_transport_stream_id transport_stream_id;
		int16_t satellitePosition;
		freq_id_t freq = 0;

		INFO("reading bouquets");

		while ((search = xmlGetNextOccurence(search, "Bouquet")) != NULL) {
			char * name = xmlGetAttribute(search, (char *) "name");
			//CZapitBouquet* newBouquet = addBouquet(xmlGetAttribute(search, (char *) "name"), bUser);
			CZapitBouquet* newBouquet = addBouquet(name, bUser);
			char* hidden = xmlGetAttribute(search, (char *) "hidden");
			char* locked = xmlGetAttribute(search, (char *) "locked");
			newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false;
			newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
			newBouquet->bFav = (strcmp(name, "favorites") == 0);
			channel_node = search->xmlChildrenNode;
			while ((channel_node = xmlGetNextOccurence(channel_node, "S")) != NULL) {
				std::string  name = xmlGetAttribute(channel_node, (char *) "n");
				GET_ATTR(channel_node, (char *) "i", SCANF_SERVICE_ID_TYPE, service_id);
				GET_ATTR(channel_node, (char *) "on", SCANF_ORIGINAL_NETWORK_ID_TYPE, original_network_id);
				GET_ATTR(channel_node, (char *) "s", SCANF_SATELLITE_POSITION_TYPE, satellitePosition);
				GET_ATTR(channel_node, (char *) "t", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id);
				GET_ATTR(channel_node, (char *) "frq", SCANF_SATELLITE_POSITION_TYPE, freq);
				if(freq > 20000) freq = freq/1000;

				CZapitChannel* chan;

				chan = findChannelByChannelID(CREATE_CHANNEL_ID64);
//printf("Bouquet Channel-ID freq %d pos %d id %llx\n", freq, satellitePosition, CREATE_CHANNEL_ID64);
				if (chan != NULL) {
//printf("found\n");
DBG("%04x %04x %04x %s\n", transport_stream_id, original_network_id, service_id, xmlGetAttribute(channel_node, (char *) "n"));
#if 0
					if(bUser && (name.length() > 1))
						chan->setName(name);
#endif
					if(!bUser)
						chan->pname = (char *) newBouquet->Name.c_str();

					chan->bAlwaysLocked = newBouquet->bLocked;
					newBouquet->addService(chan);
				}

				channel_node = channel_node->xmlNextNode;
			}
			if(!bUser)
				newBouquet->sortBouquet();
			search = search->xmlNextNode;
		}
		INFO("found %d bouquets", Bouquets.size());
	}
}
コード例 #3
0
ファイル: scanbat.cpp プロジェクト: Coolstreamto/Coolto
bool CBat::ParseLogicalChannels(LogicalChannelDescriptor * ld, BouquetAssociation * b)
{
	t_transport_stream_id transport_stream_id = b->getTransportStreamId();
	t_original_network_id original_network_id = b->getOriginalNetworkId();

	const LogicalChannelList &clist = *ld->getChannelList();
	LogicalChannelListConstIterator it;
	for (it = clist.begin(); it != clist.end(); ++it) {
		int lcn = (*it)->getLogicalChannelNumber();
		if(lcn == 0)
			continue;

		t_service_id service_id = (*it)->getServiceId();
		t_channel_id channel_id = CZapitChannel::makeChannelId(0, 0,
				transport_stream_id, original_network_id, service_id);
		/* (*it)->getVisibleServiceFlag(); */
		logical_map[channel_id] = lcn;
#ifdef DEBUG_LCN
		std::string name;
		CZapitChannel * chan = CServiceManager::getInstance()->FindChannel48(channel_id);
		if(chan)
			name = chan->getName();
		printf("BAT: logical channel %05d: tsid %04x onid %04x %016" PRIx64 " [%s] visible %d\n", lcn, transport_stream_id, original_network_id, channel_id, name.c_str(), (*it)->getVisibleServiceFlag());
#endif
	}
	return true;
}
コード例 #4
0
void CEpgScan::AddBouquet(CChannelList * clist)
{
	for (unsigned i = 0; i < clist->Size(); i++) {
		CZapitChannel * chan = clist->getChannelFromIndex(i);
		if (!IS_WEBTV(chan->getChannelID()) && scanned.find(chan->getTransponderId()) == scanned.end())
			scanmap.insert(eit_scanmap_pair_t(chan->getTransponderId(), chan->getChannelID()));
	}
}
コード例 #5
0
void CInfoViewerBB::showIcon_SubT()
{
	if (!is_visible)
		return;
	bool have_sub = false;
	CZapitChannel * cc = CNeutrinoApp::getInstance()->channelList->getChannel(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber());
	if (cc && cc->getSubtitleCount())
		have_sub = true;

	showBBIcons(CInfoViewerBB::ICON_SUBT, (have_sub) ? NEUTRINO_ICON_SUBT : NEUTRINO_ICON_SUBT_GREY);
}
コード例 #6
0
ファイル: vfd.cpp プロジェクト: star1978/neutrino-mp-cst-next
void CVFD::UpdateIcons()
{
	CZapitChannel * chan = CZapit::getInstance()->GetCurrentChannel();
	if (chan)
	{
		ShowIcon(FP_ICON_HD,chan->isHD());
		ShowIcon(FP_ICON_LOCK,!chan->camap.empty());
		if (chan->getAudioChannel() != NULL)
			ShowIcon(FP_ICON_DD, chan->getAudioChannel()->audioChannelType == CZapitAudioChannel::AC3);
	}
}
コード例 #7
0
void CVFD::UpdateIcons()
{
	j00zekDBG(DEBUG_DEBUG,"j00zek>CVFD::UpdateIcons() - DISABLED DD/AC3/HD icons\n"); //j00zek> we do NOT display those small, almost invisible, icons. :)
#if 0
	CZapitChannel * chan = CZapit::getInstance()->GetCurrentChannel();
	if (chan) {
		ShowIcon(FP_ICON_HD,chan->isHD());
		ShowIcon(FP_ICON_LOCK,!chan->camap.empty());
		if (chan->getAudioChannel() != NULL)
			ShowIcon(FP_ICON_DD, chan->getAudioChannel()->audioChannelType == CZapitAudioChannel::AC3);
	}
#endif
}
コード例 #8
0
ファイル: neutrinoyparser.cpp プロジェクト: Firmeware/max-tdt
//-------------------------------------------------------------------------
// y-func : get_channel_dropdown [<bouquet_nr> [<channel_id>]]
//-------------------------------------------------------------------------
std::string  CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *hh, std::string para)
{
	std::string abouquet, achannel_id, yresult, sel, sid;
	
	int bnumber = 1;
	int mode = CZapitClient::MODE_CURRENT;
	
	ySplitString(para," ",abouquet, achannel_id);
	if(abouquet != "")
		bnumber = atoi(abouquet.c_str());

	if(bnumber > 0) {
		bnumber--;
		ZapitChannelList channels;
		channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[bnumber]->radioChannels : g_bouquetManager->Bouquets[bnumber]->tvChannels;
		for(int j = 0; j < (int) channels.size(); j++) {
			CEPGData epg;
			CZapitChannel * channel = channels[j];
			char buf[100],id[20];
			sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->channel_id);
			std::string sid = std::string(id);
			sel = (sid == achannel_id) ? "selected=\"selected\"" : "";
			sectionsd_getActualEPGServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, &epg);
			sprintf(buf,"<option value="PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS" %s>%.20s - %.30s</option>\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str());
                        yresult += buf;
		}
	}
	return yresult;
}
コード例 #9
0
int CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mode)
{
	std::vector<CMenuWidget *> toDelete;
	CMenuWidget mctv(LOCALE_TIMERLIST_BOUQUETSELECT, NEUTRINO_ICON_SETTINGS, width);
	mctv.addIntroItems();

	for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
		CMenuWidget* mwtv = new CMenuWidget(LOCALE_TIMERLIST_CHANNELSELECT, NEUTRINO_ICON_SETTINGS, width);
		toDelete.push_back(mwtv);
		mwtv->addIntroItems();
		ZapitChannelList channels;
		if (mode == CZapitClient::MODE_RADIO)
			g_bouquetManager->Bouquets[i]->getRadioChannels(channels);
		else
			g_bouquetManager->Bouquets[i]->getTvChannels(channels);
		for(int j = 0; j < (int) channels.size(); j++) {
			CZapitChannel * channel = channels[j];
			char cChannelId[60] = {0};
			snprintf(cChannelId, sizeof(cChannelId), "ZC%c:%d|%" PRIx64 "#", (mode==CZapitClient::MODE_TV)?'T':'R', channel->number, channel->channel_id);

			CMenuForwarder * chan_item = new CMenuForwarder(channel->getName(), true, NULL, this,
				(std::string(cChannelId) + channel->getName()).c_str(), CRCInput::RC_nokey, NULL,
				channel->scrambled ? NEUTRINO_ICON_SCRAMBLED: (channel->getUrl().empty() ? NULL : NEUTRINO_ICON_STREAMING));
			chan_item->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
			mwtv->addItem(chan_item);

		}
#if 1 // FIXME, probably unneeded by now --martii
		if (g_bouquetManager->Bouquets[i]->Name == "extra.zapit_bouquetname_others"
		 || g_bouquetManager->Bouquets[i]->Name == "extra.zapit_bouquetname_newchannels")
			continue;
#endif
		if(!channels.empty() && (!g_bouquetManager->Bouquets[i]->bHidden ))
		{
			mctv.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->Name, true, NULL, mwtv));
		}
	}
	int res = mctv.exec (NULL, "");

	// delete dynamic created objects
	for(unsigned int count=0;count<toDelete.size();count++)
	{
		delete toDelete[count];
	}
	toDelete.clear();
	return res;
}
コード例 #10
0
ファイル: streamts.cpp プロジェクト: Coolstreamto/Coolto
void CStreamInstance::run()
{
	printf("CStreamInstance::run: %llx\n", channel_id);

#if 0
	dmx = new cDemux(STREAM_DEMUX);//FIXME
#endif
	CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(channel_id);
	if (!tmpchan)
		return;

	dmx = new cDemux(tmpchan->getRecordDemux());//FIXME
	dmx->Open(DMX_TP_CHANNEL, NULL, DMX_BUFFER_SIZE);

	/* pids here cannot be empty */
	stream_pids_t::iterator it = pids.begin();
	printf("CStreamInstance::run: add pid %x\n", *it);
	dmx->pesFilter(*it);
	++it;
	for (; it != pids.end(); ++it) {
		printf("CStreamInstance::run: add pid %x\n", *it);
		dmx->addPid(*it);
	}
#ifdef ENABLE_MULTI_CHANNEL
	dmx->Start();//FIXME
#else
	dmx->Start(true);//FIXME
#endif

	CCamManager::getInstance()->Start(channel_id, CCamManager::STREAM);

	while (running) {
		ssize_t r = dmx->Read(buf, IN_SIZE, 100);
		if(r > 0)
			Send(r);
	}

	CCamManager::getInstance()->Stop(channel_id, CCamManager::STREAM);

	printf("CStreamInstance::run: exiting %llx (%d fds)\n", channel_id, fds.size());

	Close();
	delete dmx;
	delete []buf;
}
コード例 #11
0
/* helper for reused code */
void CServiceManager::WriteCurrentService(FILE * fd, bool &satfound, bool &tpdone,
		bool &updated, char * satstr, struct transponder &tp, CZapitChannel &channel, const char * action)
{
	if(!tpdone) {
		if(!satfound)
			fprintf(fd, "%s", satstr);
		WriteTransponderHeader(fd, tp);
		tpdone = 1;
	}
	updated = 1;
	channel.dumpServiceXml(fd, action);
}
コード例 #12
0
void CEpgScan::ConfigureEIT()
{
	CEitManager::getInstance()->clearChannelFilters();
	if (g_settings.epg_save_mode == 0)
		return;

	int count = 0;

	for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) {
		CChannelList * clist = TVfavList->Bouquets[j]->channelList;
		for (unsigned i = 0; i < clist->Size(); i++) {
			CZapitChannel * chan = clist->getChannelFromIndex(i);
			CEitManager::getInstance()->addChannelFilter(chan->getOriginalNetworkId(), chan->getTransportStreamId(), chan->getServiceId());
			count++;
		}
	}
	for (unsigned j = 0; j < RADIOfavList->Bouquets.size(); ++j) {
		CChannelList * clist = RADIOfavList->Bouquets[j]->channelList;
		for (unsigned i = 0; i < clist->Size(); i++) {
			CZapitChannel * chan = clist->getChannelFromIndex(i);
			CEitManager::getInstance()->addChannelFilter(chan->getOriginalNetworkId(), chan->getTransportStreamId(), chan->getServiceId());
			count++;
		}
	}
	INFO("added %d channels to EIT white list\n", count);
}
コード例 #13
0
ファイル: scanepg.cpp プロジェクト: Mansouu/neutrino-mp-next
int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
{
	if (!g_settings.epg_scan || (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1))) {
		if ((msg == NeutrinoMessages::EVT_EIT_COMPLETE) || (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE))
			return messages_return::handled;
		return messages_return::unhandled;
	}

	CZapitChannel * newchan;
	if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
		AddTransponders();
		INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
		return messages_return::handled;
	}
	else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) {
		t_channel_id chid = *(t_channel_id *)data;
		newchan = CServiceManager::getInstance()->FindChannel(chid);
		if (newchan) {
			scanned.insert(newchan->getTransponderId());
			scanmap.erase(newchan->getTransponderId());
		}
		INFO("EIT read complete [" PRINTF_CHANNEL_ID_TYPE "], scan map size: %d", chid, scanmap.size());

		Next();
		return messages_return::handled;
	}
	else if (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE) {
		t_channel_id chid = *(t_channel_id *)data;
		INFO("EVT_BACK_ZAP_COMPLETE [" PRINTF_CHANNEL_ID_TYPE "]", chid);
		if (next_chid) {
			newchan = CServiceManager::getInstance()->FindChannel(next_chid);
			if (newchan) {
				if(chid) {
					if (!CRecordManager::getInstance()->RecordingStatus()) {
						INFO("try to scan [%s]", newchan->getName().c_str());
						if (standby && !g_Sectionsd->getIsScanningActive())
							g_Sectionsd->setPauseScanning(false);
						g_Sectionsd->setServiceChanged(newchan->getChannelID(), false, newchan->getRecordDemux());
					}
				} else {
					INFO("tune failed [%s]", newchan->getName().c_str());
					scanmap.erase(newchan->getTransponderId());
					Next();
				}
			}
		}
		return messages_return::handled;
	}
	return messages_return::unhandled;
}
コード例 #14
0
void CEpgScan::Next()
{
	bool llocked = false;
#ifdef ENABLE_PIP
	bool plocked = false;
#endif
	next_chid = 0;

	if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby)
		return;
	if (CRecordManager::getInstance()->RecordingStatus() || CStreamManager::getInstance()->StreamStatus())
		return;

	if (g_settings.epg_scan == SCAN_FAV && scanmap.empty())
		AddFavorites();
	if (g_settings.epg_scan == SCAN_SEL && scanmap.empty())
		AddSelected();

	if (!CheckMode() || scanmap.empty()) {
		EnterStandby();
		return;
	}

	/* executed in neutrino thread - possible race with locks in zapit zap NOWAIT :
	   send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time
	*/
	CFEManager::getInstance()->Lock();
	CFrontend *live_fe = NULL;
#ifdef ENABLE_PIP
	CFrontend *pip_fe = NULL;
#endif
	if (!standby) {
		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*/) {
			plocked = true;
			CFEManager::getInstance()->lockFrontend(pip_fe);
		}
#endif
	}
_repeat:
	for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) {
		CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second);
		if (newchan == NULL) {
			scanmap.erase(it++);
			continue;
		}
		if (CFEManager::getInstance()->canTune(newchan)) {
			INFO("try to tune [%s]", newchan->getName().c_str());
			next_chid = newchan->getChannelID();
			break;
		} else
			INFO("skip [%s], cannot tune", newchan->getName().c_str());
		++it;
	}
	if (!next_chid && ((g_settings.epg_scan == SCAN_FAV) && AddFavorites()))
		goto _repeat;
	if (!next_chid && ((g_settings.epg_scan == SCAN_SEL) && AddSelected()))
		goto _repeat;

	if (llocked)
		CFEManager::getInstance()->unlockFrontend(live_fe);
#ifdef ENABLE_PIP
	if (plocked)
		CFEManager::getInstance()->unlockFrontend(pip_fe);
#endif

	CFEManager::getInstance()->Unlock();
	if (next_chid)
		g_Zapit->zapTo_epg(next_chid, standby);
	else 
		EnterStandby();
}
コード例 #15
0
int CStreamInfo2::doSignalStrengthLoop ()
{
#define BAR_WIDTH 150
#define BAR_HEIGHT 12
	int res = menu_return::RETURN_REPAINT;
	
	neutrino_msg_t msg;
	uint64_t maxb, minb, lastb, tmp_rate;
	unsigned int current_pmt_version= pmt_version;
	int cnt = 0;
	char tmp_str[150];
	int delay_counter = 0;
	const int delay = 15;
	int offset = g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE));
	int sw = g_Font[font_info]->getRenderWidth ("99999.999");
	maxb = minb = lastb = tmp_rate = 0;
	ts_setup ();
	while (1) {
		neutrino_msg_data_t data;

		uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100);
		g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd);

		if (!mp) {
			signal.sig = frontend->getSignalStrength() & 0xFFFF;
			signal.snr = frontend->getSignalNoiseRatio() & 0xFFFF;
			signal.ber = frontend->getBitErrorRate();
		}

		int ret = update_rate ();
		if (paint_mode == 0) {
			
			if (cnt < 12)
				cnt++;
			int dheight = g_Font[font_info]->getHeight ();
			int dx1 = x + 10;

			if(!mp && delay_counter > delay + 1){
				CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
				if(channel)
					pmt_version = channel->getPmtVersion();
				if(pmt_version != current_pmt_version){
					delay_counter = 0;
				}
			}
			if (ret && (lastb != bit_s)) {
				lastb = bit_s;

				if (maxb < bit_s)
					rate.max_short_average = maxb = bit_s;
				if ((cnt > 10) && ((minb == 0) || (minb > bit_s)))
					rate.min_short_average = minb = bit_s;

				char currate[150];
				sprintf(tmp_str, "%s:",g_Locale->getText(LOCALE_STREAMINFO_BITRATE));
				g_Font[font_info]->RenderString(dx1 , average_bitrate_pos, offset+10, tmp_str, COL_INFOBAR_TEXT);

				sprintf(currate, "%5llu.%02llu", rate.short_average / 1000ULL, rate.short_average % 1000ULL);
				frameBuffer->paintBoxRel (dx1 + average_bitrate_offset , average_bitrate_pos -dheight, sw, dheight, COL_MENUHEAD_PLUS_0);

				g_Font[font_info]->RenderString (dx1 + average_bitrate_offset , average_bitrate_pos, sw - 10, currate, COL_INFOBAR_TEXT);

				sprintf(tmp_str, "(%s)",g_Locale->getText(LOCALE_STREAMINFO_AVERAGE_BITRATE));
				g_Font[font_info]->RenderString (dx1 + average_bitrate_offset + sw , average_bitrate_pos, sw *2, tmp_str, COL_INFOBAR_TEXT);

			}
			if (!mp) {
				showSNR ();
				if(pmt_version != current_pmt_version && delay_counter > delay){
					current_pmt_version = pmt_version;
					paint_techinfo (x + 10, y+ hheight +5);
				}
			}
			delay_counter++;
		}
		rate.short_average = abit_s;
		if (signal.max_ber < signal.ber)
			signal.max_ber = signal.ber;

		if (signal.max_sig < signal.sig)
			signal.max_sig = signal.sig;

		if (signal.max_snr < signal.snr)
			signal.max_snr = signal.snr;

		if ((signal.min_ber == 0) || (signal.min_ber > signal.ber))
			signal.min_ber = signal.ber;

		if ((signal.min_sig == 0) || (signal.min_sig > signal.sig))
			signal.min_sig = signal.sig;

		if ((signal.min_snr == 0) || (signal.min_snr > signal.snr))
			signal.min_snr = signal.snr;

		paint_signal_fe(rate, signal);

		signal.old_sig = signal.sig;
		signal.old_snr = signal.snr;
		signal.old_ber = signal.ber;

		// switch paint mode
		if (msg == CRCInput::RC_red || msg == CRCInput::RC_blue || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow) {
			hide ();
			paint_mode = !paint_mode;
			paint (paint_mode);
			continue;
		}
		else if(msg == CRCInput::RC_setup) {
			res = menu_return::RETURN_EXIT_ALL;
			break;
		}
		else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) {
			g_RCInput->postMsg (msg, 0);
			res = menu_return::RETURN_EXIT_ALL;
			break;
		}
		else if (msg == (neutrino_msg_t) g_settings.key_screenshot) {
			CNeutrinoApp::getInstance ()->handleMsg (msg, data);
			continue;
		}

		// -- any key --> abort
		if (msg <= CRCInput::RC_MaxRC)
			break;

		// -- push other events
		if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout)
			CNeutrinoApp::getInstance ()->handleMsg (msg, data);
	}
	delete signalbox;
	signalbox = NULL;
	ts_close ();
	return res;
}
コード例 #16
0
ファイル: capmt.cpp プロジェクト: Coolstreamto/Coolto
bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start, bool force_update)
{
	CCam * cam;
	int oldmask, newmask;
	int demux = DEMUX_SOURCE_0;
	int source = DEMUX_SOURCE_0;

	CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);

	if(channel == NULL) {
		printf("CCamManager: channel %" PRIx64 " not found\n", channel_id);
		return false;
	}
	//INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
	mutex.lock();

	cammap_iterator_t it = channel_map.find(channel_id);
	if(it != channel_map.end()) {
		cam = it->second;
	} else if(start) {
		cam = new CCam();
		channel_map.insert(std::pair<t_channel_id, CCam*>(channel_id, cam));
	} else {
		mutex.unlock();
		return false;
	}

	/* FIXME until proper demux management */
	switch(mode) {
		case PLAY:
			source = DEMUX_SOURCE_0;
			demux = LIVE_DEMUX;
			break;
		case STREAM:
		case RECORD:
			source = channel->getRecordDemux();
			demux = channel->getRecordDemux();
			break;
#if 0
		case STREAM:
			source = DEMUX_SOURCE_0;
			demux = STREAM_DEMUX;
			break;
#endif
		case PIP:
			source = channel->getRecordDemux();
			demux = channel->getPipDemux();
			break;
	}

	oldmask = cam->getCaMask();
	if(force_update)
		newmask = oldmask;
	else
		newmask = cam->makeMask(demux, start);

	if(cam->getSource() > 0)
		source = cam->getSource();

	INFO("channel %" PRIx64 " [%s] mode %d %s src %d mask %d -> %d update %d", channel_id, channel->getName().c_str(),
			mode, start ? "START" : "STOP", source, oldmask, newmask, force_update);
	//INFO("source %d old mask %d new mask %d force update %s", source, oldmask, newmask, force_update ? "yes" : "no");
	if((oldmask != newmask) || force_update) {
		cam->setCaMask(newmask);
		cam->setSource(source);
		if(newmask == 0) {
			cam->sendMessage(NULL, 0, false);
			cam->sendCaPmt(channel->getChannelID(), NULL, 0);
		} else {
			cam->makeCaPmt(channel, true);
			cam->setCaPmt(true);
		}
	}

	if(newmask == 0) {
		/* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
		 * (see CMD_SB_LOCK / UNLOCK PLAYBACK */
		//channel->setRawPmt(NULL);//FIXME
		channel_map.erase(channel_id);
		delete cam;
	}
	CaIdVector caids;
	cCA::GetInstance()->GetCAIDS(caids);
	//uint8_t list = CCam::CAPMT_FIRST;
	uint8_t list = CCam::CAPMT_ONLY;
	if (channel_map.size() > 1)
		list = CCam::CAPMT_ADD;
	for (it = channel_map.begin(); it != channel_map.end(); /*++it*/)
	{
		cam = it->second;
		channel = CServiceManager::getInstance()->FindChannel(it->first);
		++it;
		if(!channel)
			continue;

#if 0
		if (it == channel_map.end())
			list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST
#endif

		cam->makeCaPmt(channel, false, list, caids);
		int len;
		unsigned char * buffer = channel->getRawPmt(len);
		cam->sendCaPmt(channel->getChannelID(), buffer, len);
		//list = CCam::CAPMT_MORE;
	}
	mutex.unlock();

	return true;
}
コード例 #17
0
int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
{
	if ((msg == NeutrinoMessages::EVT_TIMER) && (data == rescan_timer)) {
		INFO("rescan timer in %s mode, scanning %d", standby ? "standby" : "live", scan_in_progress);
		scanned.clear();
		Clear();
		g_RCInput->killTimer(rescan_timer);
		if (CheckMode()) {
			if (standby)
				CNeutrinoApp::getInstance()->wakeupFromStandby();
			Start(standby);
		} else {
			AddTimer();
		}
		return messages_return::handled;
	}
	if (!CheckMode()) {
		int ret = messages_return::handled;
		if (msg == NeutrinoMessages::EVT_EIT_COMPLETE)
			scan_in_progress = false;
		else if (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE)
			scan_in_progress = true;
		else
			ret = messages_return::unhandled;
		return ret;
	}

	CZapitChannel * newchan;
	if (msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
		/* live channel changed, block scan channel change by timer */
		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) {
		scan_in_progress = false;
		t_channel_id chid = *(t_channel_id *)data;
		newchan = CServiceManager::getInstance()->FindChannel(chid);
		if (newchan) {
			scanned.insert(newchan->getTransponderId());
			scanmap.erase(newchan->getTransponderId());
		}
		INFO("EIT read complete [" PRINTF_CHANNEL_ID_TYPE "], scan map size: %d", chid, scanmap.size());

		Next();
		return messages_return::handled;
	}
	else if (msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE) {
		scan_in_progress = true;
		t_channel_id chid = *(t_channel_id *)data;
		INFO("EVT_BACK_ZAP_COMPLETE [" PRINTF_CHANNEL_ID_TYPE "]", chid);
		if (next_chid) {
			newchan = CServiceManager::getInstance()->FindChannel(next_chid);
			if (newchan) {
				if(chid) {
					if (!CRecordManager::getInstance()->RecordingStatus()) {
						INFO("try to scan [%s]", newchan->getName().c_str());
						if (standby && !g_Sectionsd->getIsScanningActive())
							g_Sectionsd->setPauseScanning(false);
						g_Sectionsd->setServiceChanged(newchan->getChannelID(), false, newchan->getRecordDemux());
					}
				} else {
					INFO("tune failed [%s]", newchan->getName().c_str());
					scanmap.erase(newchan->getTransponderId());
					Next();
				}
			}
		}
		return messages_return::handled;
	}
	return messages_return::unhandled;
}
コード例 #18
0
void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
{
	xmlDocPtr parser;

	parser = parseXmlFile(fname);
	if (parser == NULL)
		return;

	xmlNodePtr root = xmlDocGetRootElement(parser);
	xmlNodePtr search = root->xmlChildrenNode;
	xmlNodePtr channel_node;

	if (search) {
		t_original_network_id original_network_id;
		t_service_id service_id;
		t_transport_stream_id transport_stream_id;
		int16_t satellitePosition;
		freq_id_t freq = 0;

		INFO("reading bouquets from %s", fname);

		while ((search = xmlGetNextOccurence(search, "Bouquet")) != NULL) {
			char * name = xmlGetAttribute(search, "name");
			if(name == NULL)
				name = const_cast<char*>("Unknown");

			CZapitBouquet* newBouquet = addBouquet(name, bUser);
			char* hidden = xmlGetAttribute(search, "hidden");
			char* locked = xmlGetAttribute(search, "locked");
			char* scanepg = xmlGetAttribute(search, "epg");
			newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false;
			newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
			newBouquet->bFav = (strcmp(name, "favorites") == 0);
			newBouquet->bScanEpg = scanepg ? (strcmp(scanepg, "1") == 0) : false;
			channel_node = search->xmlChildrenNode;
			while ((channel_node = xmlGetNextOccurence(channel_node, "S")) != NULL) {
				std::string  name2 = xmlGetAttribute(channel_node, "n");
				char *url = xmlGetAttribute(channel_node, "u");
				GET_ATTR(channel_node, "i", SCANF_SERVICE_ID_TYPE, service_id);
				GET_ATTR(channel_node, "on", SCANF_ORIGINAL_NETWORK_ID_TYPE, original_network_id);
				GET_ATTR(channel_node, "s", SCANF_SATELLITE_POSITION_TYPE, satellitePosition);
				GET_ATTR(channel_node, "t", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id);
				GET_ATTR(channel_node, "frq", SCANF_SATELLITE_POSITION_TYPE, freq);
				if(freq > 20000)
					freq = freq/1000;

				CZapitChannel* chan;
				t_channel_id chid = create_channel_id64(service_id, original_network_id, transport_stream_id,
									satellitePosition, freq, url);
				/* FIXME to load old cable settings with new cable "positions" started from 0xF00 */
				if(!url && (bUser || CFEManager::getInstance()->cableOnly()))
					chan = CServiceManager::getInstance()->FindChannelFuzzy(chid, satellitePosition, freq);
				else
					chan = CServiceManager::getInstance()->FindChannel(chid);
				if (chan != NULL) {
					DBG("%04x %04x %04x %s\n", transport_stream_id, original_network_id, service_id, xmlGetAttribute(channel_node, "n"));
#if 0
					if(bUser && (name2.length() > 1))
						chan->setName(name2);
#endif
					if(!bUser)
						chan->pname = (char *) newBouquet->Name.c_str();

					newBouquet->addService(chan);
				} else if (bUser) {
					chan = new CZapitChannel(name2, chid, 1 /*service_type*/, satellitePosition, freq);
					CServiceManager::getInstance()->AddChannel(chan);
					chan->flags = CZapitChannel::NOT_FOUND;
					newBouquet->addService(chan);
					CServiceManager::getInstance()->SetServicesChanged(false);
				}

				channel_node = channel_node->xmlNextNode;
				if(!bUser) {
					/* set satellite position for provider bouquets.
					   reset position to 0, if position not match - means mixed bouquet */
					if (newBouquet->satellitePosition == INVALID_SAT_POSITION)
						newBouquet->satellitePosition = satellitePosition;
					else if (newBouquet->satellitePosition != satellitePosition)
						newBouquet->satellitePosition = 0;
				}
			}
			if(!bUser)
				newBouquet->sortBouquet();
			search = search->xmlNextNode;
		}
		INFO("total: %d bouquets", (int)Bouquets.size());
	}
	xmlFreeDoc(parser);
}
コード例 #19
0
int CAudioSelectMenuHandler::doMenu ()
{
	int mode = CNeutrinoApp::getInstance()->getMode();
	if (mode == NeutrinoMessages::mode_webtv) {
		CMoviePlayerGui::getInstance(true).selectAudioPid();
		return menu_return::RETURN_EXIT;
	}
	CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);

	CSubtitleChangeExec SubtitleChanger;

	//show cancel button if configured in usermenu settings
	if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
		AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
	else
		AudioSelector.addItem(GenericMenuSeparator);

	unsigned int shortcut_num = 1;

	uint p_count = g_RemoteControl->current_PIDs.APIDs.size();
	// -- setup menue due to Audio PIDs
	for( uint i=0; i < p_count; i++ )
	{
		char apid[5];
		sprintf(apid, "%d", i);
		CMenuForwarder *fw = new CMenuForwarder(g_RemoteControl->current_PIDs.APIDs[i].desc,
				true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1));
		fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
		AudioSelector.addItem(fw, (i == g_RemoteControl->current_PIDs.PIDs.selected_apid));
		shortcut_num = i+1;
	}
	if (p_count)
		AudioSelector.addItem(GenericMenuSeparatorLine);

	// -- setup menue for to Dual Channel Stereo
	CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE,
			&g_settings.audio_AnalogMode,
			AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
			true, audioSetupNotifier, CRCInput::RC_red);

	AudioSelector.addItem( oj );

	if (!g_settings.easymenu) {
		oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out,
				OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,
				true, audioSetupNotifier, CRCInput::RC_green);
		AudioSelector.addItem( oj );
	}

	CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
	int curnum = channelList->getActiveChannelNumber();
	CZapitChannel * cc = channelList->getChannel(curnum);

	bool sep_added = false;
	if(cc)
	{
		for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i)
		{
			CZapitAbsSub* s = cc->getChannelSub(i);
			if (s->thisSubType == CZapitAbsSub::DVB) {
				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId);
				if(!sep_added)
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[10];
				snprintf(spid,sizeof(spid), "DVB:%d", sd->pId);
				char item[64];
				snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId);
				AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/,
							sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
			}
			if (s->thisSubType == CZapitAbsSub::TTX)
			{
				CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
				printf("[neutrino] adding TTX subtitle %s pid %x mag %X page %x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number);
				if(!sep_added)
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[64];
				int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
				int pid = sd->pId;
				snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str());
				char item[64];
				snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
				AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/,
							!tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
			}
		}

		if(sep_added) {
			CMenuForwarder * item = new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop);
			item->setItemButton(NEUTRINO_ICON_BUTTON_STOP, false);
			AudioSelector.addItem(item);
		}
	}

	AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST));

	/* setting volume percent to zapit with channel_id/apid = 0 means current channel and pid */
	CVolume::getInstance()->SetCurrentChannel(0);
	CVolume::getInstance()->SetCurrentPid(0);
	int percent[p_count];
	for (uint i=0; i < p_count; i++) {
		percent[i] = CZapit::getInstance()->GetPidVolume(0, g_RemoteControl->current_PIDs.APIDs[i].pid, g_RemoteControl->current_PIDs.APIDs[i].is_ac3);
		AudioSelector.addItem(new CMenuOptionNumberChooser(g_RemoteControl->current_PIDs.APIDs[i].desc,
					&percent[i], i == g_RemoteControl->current_PIDs.PIDs.selected_apid,
					0, 999, CVolume::getInstance()));
	}

	return AudioSelector.exec(NULL, "");
}
コード例 #20
0
void CStreamInfo2::paint_techinfo(int xpos, int ypos)
{
	char buf[100];
	int xres = 0, yres = 0, aspectRatio = 0, framerate = -1;
	// paint labels
	int spaceoffset = 0,i = 0;
	int ypos1 = ypos;
	int box_width = width*2/3 - 10;

	yypos = ypos;
	if(box_h > 0)
		frameBuffer->paintBoxRel (0, ypos, box_width, box_h, COL_MENUHEAD_PLUS_0);

	CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
	if(!channel)
		return;

	int array[6]={g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)),
		      g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_ARATIO)),
		      g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)),
		      g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE)),
		      g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)),
		      g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_SCANTS_FREQDATA))};

	for(i=0 ; i<6; i++) {
		if(spaceoffset < array[i])
			spaceoffset = array[i];
	}
	spaceoffset += g_Font[font_info]->getRenderWidth(" ");

	average_bitrate_offset = spaceoffset;

	if((channel->getVideoPid() || IS_WEBTV(channel->getChannelID())) && !(videoDecoder->getBlank())){
		 videoDecoder->getPictureInfo(xres, yres, framerate);
		 if (yres == 1088)
		 	yres = 1080;
		 aspectRatio = videoDecoder->getAspectRatio();
	}

	//Video RESOLUTION
	ypos += iheight;
	sprintf (buf, "%s:",g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION));
	g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT);
	sprintf (buf, "%dx%d", xres, yres);
	g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

	//audio rate
	ypos += iheight;
	sprintf (buf, "%s:",g_Locale->getText (LOCALE_STREAMINFO_ARATIO));
	g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT);
	switch (aspectRatio) {
		case 0:
			sprintf (buf, "N/A");
			break;
		case 1:
			sprintf (buf, "4:3");
			break;
		case 2:
			sprintf (buf, "14:9");
			break;
		case 3:
			sprintf (buf, "16:9");
			break;
		case 4:
			sprintf (buf, "20:9");
			break;
		default:
			strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_ARATIO_UNKNOWN), sizeof (buf)-1);
	}
	g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

	//Video FRAMERATE
	ypos += iheight;
	sprintf (buf, "%s:", g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE));
	g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT);
	switch (framerate) {
		case 0:
			snprintf (buf,sizeof(buf), "23.976fps");
			break;
		case 1:
			snprintf (buf,sizeof(buf), "24fps");
			break;
		case 2:
			snprintf (buf,sizeof(buf), "25fps");
			break;
		case 3:
			snprintf (buf,sizeof(buf), "29,976fps");
			break;
		case 4:
			snprintf (buf,sizeof(buf), "30fps");
			break;
		case 5:
			snprintf (buf,sizeof(buf), "50fps");
			break;
		case 6:
			snprintf (buf,sizeof(buf), "50,94fps");
			break;
		case 7:
			snprintf (buf,sizeof(buf), "60fps");
			break;
		default:
			strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE_UNKNOWN), sizeof (buf)-1);
			break;
	}
	g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);
	// place for average bitrate
	average_bitrate_pos = ypos += iheight;
	//AUDIOTYPE
	ypos += iheight;
	int type, layer, freq, mode, lbitrate;
	audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode);

	sprintf (buf, "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE));
	g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_INFOBAR_TEXT);

	if(type == AUDIO_FMT_MPEG) {
		const int max_mode = 4;
		const char *mpegmodes[max_mode] = { "stereo", "joint_st", "dual_ch", "single_ch" };
		sprintf (buf, "MPEG %s (%d)", (mode > max_mode) ?"unk":mpegmodes[mode], freq);
	} else if (type == AUDIO_FMT_DOLBY_DIGITAL || type == AUDIO_FMT_DD_PLUS) {
		const int max_mode = 8;
		const char *ddmodes[max_mode] = { "CH1/CH2", "C", "L/R", "L/C/R", "L/R/S", "L/C/R/S", "L/R/SL/SR", "L/C/R/SL/SR" };
		sprintf (buf, "%s %s (%d)",
			 (type == AUDIO_FMT_DOLBY_DIGITAL) ? "DD" : "DD+",
			 (mode > max_mode) ?"unk": ddmodes[mode],
			 freq);
	} else if (type == AUDIO_FMT_AAC || type == AUDIO_FMT_AAC_PLUS) {
		const int max_mode = 10;
		const char *aacmodes[max_mode] = {
			"N/S",
			"Mono",
			"L/R",
			"L/C/R",
			"L/C/R/SR/SL",
			"L/C/R/SR/SL/S",
			"L/R/RL/RR",
			"L/C/R/S",
			"L/R/SL/SR",
			"Dual-Mono"
		};
		sprintf (buf, "%s %s (%d)",
			 (type == AUDIO_FMT_AAC) ? "AAC" : "AAC+",
			 (mode > max_mode) ?"unk":aacmodes[mode], freq);
	} else {
		sprintf (buf, "%s (%d)", g_Locale->getText(LOCALE_STREAMINFO_AUDIOTYPE_UNKNOWN), freq);
	}
	g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

	if (mp) {
		//channel
		ypos += iheight;
		if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) {
			sprintf (buf, "%s:",g_Locale->getText (LOCALE_TIMERLIST_CHANNEL));//swiped locale
			g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT);
			sprintf(buf, "%s", channel->getName().c_str());
			g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);
		} else {
			sprintf (buf, "%s:",g_Locale->getText (LOCALE_MOVIEBROWSER_INFO_FILE));//swiped locale
			g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT);
			sprintf(buf, "%s", mp->GetFile().c_str());
			g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);
		}

		scaling = 27000;
	} else {

		transponder t;
		t = *frontend->getParameters();
		//satellite
		ypos += iheight;
		if (CFrontend::isSat(t.feparams.delsys))
			sprintf (buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale
		else if (CFrontend::isCable(t.feparams.delsys))
			sprintf (buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS));
		else if (CFrontend::isTerr(t.feparams.delsys))
			snprintf (buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TERRESTRIALSETUP_AREA));

		g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR_TEXT);

		sprintf (buf, "%s", IS_WEBTV(channel->getChannelID()) ? g_Locale->getText(LOCALE_WEBTV_HEAD) :
				CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()).c_str());
		g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//channel
		ypos += iheight;
		sprintf (buf, "%s:",g_Locale->getText (LOCALE_TIMERLIST_CHANNEL));//swiped locale
		g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT);
		sprintf(buf, "%s", channel->getName().c_str());
		g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//tsfrequenz
		ypos += iheight;

		scaling = 27000;
		if (CFrontend::isSat(t.feparams.delsys) && t.feparams.delsys == DVB_S)
			scaling = 15000;

		sprintf (buf, "%s",g_Locale->getText (LOCALE_SCANTS_FREQDATA));
		g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_INFOBAR_TEXT);
		g_Font[font_info]->RenderString(xpos+spaceoffset, ypos, box_width, t.description().c_str(), COL_INFOBAR_TEXT);

		// paint labels
		int fontW = g_Font[font_small]->getWidth();
		spaceoffset = 7 * fontW;
		//onid
		ypos+= sheight;
		sprintf(buf, "0x%04X (%i)", channel->getOriginalNetworkId(), channel->getOriginalNetworkId());
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "ONid:" , COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//sid
		ypos+= sheight;
		sprintf(buf, "0x%04X (%i)", channel->getServiceId(), channel->getServiceId());
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "Sid:" , COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//tsid
		ypos+= sheight;
		sprintf(buf, "0x%04X (%i)", channel->getTransportStreamId(), channel->getTransportStreamId());
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "TSid:" , COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//pmtpid
		ypos+= sheight;
		pmt_version = channel->getPmtVersion();
		sprintf(buf, "0x%04X (%i) [0x%02X]", channel->getPmtPid(), channel->getPmtPid(), pmt_version);
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "PMTpid:", COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//vpid
		ypos+= sheight;
		if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){
			sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vpid, g_RemoteControl->current_PIDs.PIDs.vpid );
		} else {
			sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE));
		}
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "Vpid:" , COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);

		//apid
		ypos+= sheight;
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "Apid(s):" , COL_INFOBAR_TEXT);
		if (g_RemoteControl->current_PIDs.APIDs.empty()){
			sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE));
		} else {
			unsigned int sw=spaceoffset;
			for (unsigned int li= 0; (li<g_RemoteControl->current_PIDs.APIDs.size()) && (li<10); li++)
			{
				sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.APIDs[li].pid, g_RemoteControl->current_PIDs.APIDs[li].pid );
				if (li == g_RemoteControl->current_PIDs.PIDs.selected_apid){
					g_Font[font_small]->RenderString(xpos+sw, ypos, box_width, buf, COL_MENUHEAD_TEXT);
				}
				else{
					g_Font[font_small]->RenderString(xpos+sw, ypos, box_width, buf, COL_INFOBAR_TEXT);
				}
				sw = g_Font[font_small]->getRenderWidth(buf)+sw+10;
				if (((li+1)%3 == 0) &&(g_RemoteControl->current_PIDs.APIDs.size()-1 > li)){ // if we have lots of apids, put "intermediate" line with pids
					ypos+= sheight;
					sw=spaceoffset;
				}
			}
		}

		//vtxtpid
		ypos += sheight;
		if ( g_RemoteControl->current_PIDs.PIDs.vtxtpid == 0 )
			sprintf(buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE));
		else
			sprintf(buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vtxtpid, g_RemoteControl->current_PIDs.PIDs.vtxtpid );
		g_Font[font_small]->RenderString(xpos, ypos, box_width, "VTXTpid:" , COL_INFOBAR_TEXT);
		g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR_TEXT);
		if(box_h == 0)
			box_h = ypos - ypos1;
		yypos = ypos;
		paintCASystem(xpos,ypos);
	}
}
コード例 #21
0
int CAudioSelectMenuHandler::doMenu ()
{
	CMenuWidget AudioSelector(LOCALE_APIDSELECTOR_HEAD, "audio", 360);
	unsigned int count;
	CSubtitleChangeExec SubtitleChanger;

	for(count=0; count < g_RemoteControl->current_PIDs.APIDs.size(); count++ ) {
		char apid[5];
		sprintf(apid, "%d", count);
		AudioSelector.addItem(new CMenuForwarderNonLocalized(
					g_RemoteControl->current_PIDs.APIDs[count].desc, true, NULL,
					APIDChanger, apid, CRCInput::convertDigitToKey(count + 1)),
				(count == g_RemoteControl->current_PIDs.PIDs.selected_apid));
	}

	// -- setup menue for to Dual Channel Stereo
	AudioSelector.addItem(GenericMenuSeparatorLine);

	CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOGOUT,
				&g_settings.audio_AnalogMode,
				AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
				true, audioSetupNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);

	AudioSelector.addItem( oj );

	CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
	int curnum = channelList->getActiveChannelNumber();
	CZapitChannel * cc = channelList->getChannel(curnum);

	bool sep_added = false;
	if(cc) 
	{
		bool subs_running = false;
		for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i) 
		{
			CZapitAbsSub* s = cc->getChannelSub(i);
			if (s->thisSubType == CZapitAbsSub::DVB) {
				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				fprintf(stderr, "[neutrino] adding DVB subtitle %s pid 0x%x\n", sd->ISO639_language_code.c_str(), sd->pId);
				if(!sep_added) {
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[10];
				snprintf(spid,sizeof(spid), "DVB:%d", sd->pId);
				char item[64];
				snprintf(item,sizeof(item), "DVB: %s (pid %03X)", sd->ISO639_language_code.c_str(), sd->pId);
				bool this_sub_running = (sd->pId == dvbsub_getpid());
				subs_running |= this_sub_running;
				AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
							!this_sub_running, NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++count)));
			} else if (s->thisSubType == CZapitAbsSub::TTX) {
				CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
				fprintf(stderr, "[neutrino] adding TTX subtitle %s pid %X mag %d page %d\n",
					sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number);
				if(!sep_added) {
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[64];
				int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
				int pid = sd->pId;
				snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str()); 
				char item[64];
				snprintf(item,sizeof(item), "TTX: %s (pid %X page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
				bool this_sub_running = tuxtx_subtitle_running(&pid, &page, NULL);
				subs_running |= this_sub_running;
				AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
							!this_sub_running, NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++count)));
			}
		}
		
		if(sep_added) {
			if (subs_running)
				AudioSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop));
		} else {
			// subtitles might not be available, but started by zapit anyway, as it remembers pids
			dvbsub_stop();
			tuxtx_stop_subtitle();
		}
	}
	AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VOLUME_ADJUSTMENT));

	int percent[g_RemoteControl->current_PIDs.APIDs.size()];
	CZapitClient zapit;
	for(count = 0; count < g_RemoteControl->current_PIDs.APIDs.size(); count++ ) {
		zapit.getVolumePercent((unsigned int *) &percent[count], g_RemoteControl->current_PIDs.APIDs[count].pid);
		AudioSelector.addItem(new CMenuOptionNumberChooser(NONEXISTANT_LOCALE, &percent[count],
			count == g_RemoteControl->current_PIDs.PIDs.selected_apid,
			0, 999, audioSetupNotifier, 0, 0, NONEXISTANT_LOCALE,
			g_RemoteControl->current_PIDs.APIDs[count].desc));
	}

	return AudioSelector.exec(NULL, "");
}
コード例 #22
0
//-------------------------------------------------------------------------
// TODO: clean up code
// use templates?
//-------------------------------------------------------------------------
std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std::string para)
{
	int BouquetNr = 0;
	std::string abnumber, tmp,yresult;
	ZapitChannelList channels;
	//int num;
	int mode = NeutrinoAPI->Zapit->getMode();

	ySplitString(para," ",abnumber, tmp);
	if(abnumber != "")
		BouquetNr = atoi(abnumber.c_str());
	if (BouquetNr > 0) {
		BouquetNr--;
#if 0
		channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[BouquetNr]->radioChannels : g_bouquetManager->Bouquets[BouquetNr]->tvChannels;
		num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr) : g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr)) ;
#endif
		if (mode == CZapitClient::MODE_RADIO)
			g_bouquetManager->Bouquets[BouquetNr]->getRadioChannels(channels);
		else
			g_bouquetManager->Bouquets[BouquetNr]->getTvChannels(channels);
	} else {
		CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
		for (; !(cit.EndOfChannels()); cit++)
			channels.push_back(*cit);
		//num = 1;
	}
	NeutrinoAPI->GetChannelEvents();

	int i = 1;
	char classname;
	t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID();
	int prozent = 100;
	CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
	std::string timestr;
	bool have_logos = false;

	if(hh->WebserverConfigList["Tuxbox.LogosURL"] != "")
		have_logos = true;
	for(int j = 0; j < (int) channels.size(); j++)
	{
		CZapitChannel * channel = channels[j];
		CChannelEvent *event;
		event = NeutrinoAPI->ChannelListEvents[channel->channel_id];

		classname = (i++ & 1) ? 'a' : 'b';
		if (channel->channel_id == current_channel)
			classname = 'c';

		std::string bouquetstr = (BouquetNr >= 0) ? ("&amp;bouquet=" + itoa(BouquetNr)) : "";
		yresult += "<tr>";

		if(have_logos)
			yresult += string_printf("<td class=\"%c\" width=\"44\" rowspan=\"2\"><a href=\"javascript:do_zap('"
					PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
					"')\"><img class=\"channel_logo\" src=\"%s\"/></a></td>", classname, channel->channel_id,
					(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)).c_str());

		/* timer slider */
		if(event && event->duration > 0)
		{
			prozent = 100 * (time(NULL) - event->startTime) / event->duration;
			yresult += string_printf("<td class=\"%c\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n"
					"\t<table border=\"0\" rules=\"none\" class=\"cslider cslider_table\">"
					"<tr>"
					"<td class=\"cslider cslider_used\" width=\"%d\"></td>"
					"<td class=\"cslider cslider_free\" width=\"%d\"></td>"
					"</tr>"
					"</table>\n</td>\n"
					, classname
					, (prozent / 10) * 3
					, (10 - (prozent / 10))*3
				);
		}
		else
		{
			yresult += string_printf("<td class=\"%c\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n"
					"\t<table border=\"0\" rules=\"none\" class=\"cslider cslider_table\">"
					"<tr>"
					"<td class=\"cslider cslider_noepg\"></td>"
					"</tr>"
					"</table>\n</td>\n"
					, classname
				);
		}

		/* channel name and buttons */
		yresult += string_printf("<td>\n%s<a class=\"clist\" href=\"javascript:do_zap('"
				PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
				"')\">&nbsp;%d. %s%s</a>&nbsp;<a href=\"javascript:do_epg('"
				PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
				"','"
				PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
				"')\">%s</a>\n",
				((channel->channel_id == current_channel) ? "<a name=\"akt\"></a>" : " "),
				channel->channel_id,
				channel->number /* num + j */,
				channel->getName().c_str(),
				(channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
				channel->channel_id,
				channel->channel_id & 0xFFFFFFFFFFFFULL,
				((NeutrinoAPI->ChannelListEvents[channel->channel_id]) ? "<img src=\"/images/elist.gif\" alt=\"Program preview\" style=\"border: 0px\" />" : ""));

		if (channel->channel_id == current_channel)
			yresult += string_printf("\n&nbsp;&nbsp;<a href=\"javascript:do_streaminfo()\"><img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" style=\"border: 0px\" /></a>");

		yresult += string_printf("</td></tr></table>\n</td>\n</tr>\n");

		if (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE)
		{
			CSectionsdClient::NVODTimesList nvod_list;
			if (CEitManager::getInstance()->getNVODTimesServiceKey(channel->channel_id, nvod_list))
			{
				CZapitClient::subServiceList subServiceList;

				for (CSectionsdClient::NVODTimesList::iterator ni = nvod_list.begin(); ni != nvod_list.end(); ++ni)
				{
					CZapitClient::commandAddSubServices cmd;
					CEPGData epg;

					// Byte Sequence by ntohs
					cmd.original_network_id = ntohs(ni->original_network_id);
					cmd.service_id = ntohs(ni->service_id);
					cmd.transport_stream_id = ntohs(ni->transport_stream_id);

					t_channel_id channel_id = CREATE_CHANNEL_ID(cmd.service_id, cmd.original_network_id, cmd.transport_stream_id);

					timestr = timeString(ni->zeit.startzeit); // FIXME: time is wrong (at least on little endian)!
					CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epg); // FIXME: der scheissendreck geht nit!!!
					yresult += string_printf("<tr>\n<td align=\"left\" style=\"width: 31px\" class=\"%cepg\">&nbsp;</td>", classname);
					yresult += string_printf("<td class=\"%cepg\">%s&nbsp;", classname, timestr.c_str());
					yresult += string_printf("%s<a href=\"javascript:do_zap('"
							PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
							")'\">%04x:%04x:%04x %s</a>", // FIXME: get name
							(channel_id == current_channel) ? "<a name=\"akt\"></a>" : " ",
							channel_id,
							bouquetstr.c_str(),
							cmd.transport_stream_id,
							cmd.original_network_id,
							cmd.service_id,
							epg.title.c_str());
					yresult += string_printf("</td>\n</tr>");

					subServiceList.push_back(cmd);
				}

				if (!(subServiceList.empty()))
					NeutrinoAPI->Zapit->setSubServices(subServiceList);
			}
		}

		else if ((event = NeutrinoAPI->ChannelListEvents[channel->channel_id]))
		{
			bool has_current_next = true;
			CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo);
			timestr = timeString(event->startTime);

			yresult += string_printf("<tr><td class=\"%cepg\">",classname);
			yresult += string_printf("%s&nbsp;%s&nbsp;"
					"<span style=\"font-size: 8pt; white-space: nowrap\">(%ld von %d min, %d%%)</span>"
					, timestr.c_str()
					, event->description.c_str()
					, (time(NULL) - event->startTime)/60
					, event->duration / 60,prozent);

			if ((has_current_next) && (currentNextInfo.flags & CSectionsdClient::epgflags::has_next)) {
				timestr = timeString(currentNextInfo.next_zeit.startzeit);
				yresult += string_printf("<br />%s&nbsp;%s", timestr.c_str(), currentNextInfo.next_name.c_str());
			}

			yresult += string_printf("</td></tr>\n");
		}
		else
		yresult += string_printf("<tr style=\"height: 2px\"><td></td></tr>\n");
	}
	return yresult;
}
コード例 #23
0
int CAudioSelectMenuHandler::doMenu ()
{
	AudioSelector = new CMenuWidget(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);

	CSubtitleChangeExec SubtitleChanger(playback);

	//show cancel button if configured in usermenu settings
	if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
		AudioSelector->addIntroItems(NONEXISTANT_LOCALE, LOCALE_AUDIOSELECTMENUE_VOLUME, CMenuWidget::BTN_TYPE_CANCEL);
	else
		AudioSelector->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOSELECTMENUE_VOLUME));
	apid_offset = AudioSelector->getItemsCount();
	AudioSelector->addKey(CRCInput::RC_right, this, "+");
	AudioSelector->addKey(CRCInput::RC_left, this, "-");
	AudioSelector->addKey(CRCInput::RC_red, this, "x");
	AudioSelector->addKey(CRCInput::RC_green, this, "x");
	AudioSelector->addKey(CRCInput::RC_yellow, this, "x");
	AudioSelector->addKey(CRCInput::RC_blue, this, "x");

	bool is_mp = mp->Playing();

	p_count = is_mp ? mp->getAPIDCount() : g_RemoteControl->current_PIDs.APIDs.size();
	sel_apid = is_mp ? mp->getAPID() : g_RemoteControl->current_PIDs.PIDs.selected_apid;

	int _apid[p_count];
	int _perc_val[p_count];
	unsigned int _is_ac3[p_count];
	std::string _perc_str[p_count];
	perc_val = _perc_val;
	perc_str = _perc_str;
	is_ac3 = _is_ac3;
	apid = _apid;
	chan = is_mp ? mp->getChannelId() : 0;

	// -- setup menue due to Audio PIDs
	for (int i = 0; i < p_count; i++)
	{
		if (is_mp) {
			mp->getAPID(i, apid[i], is_ac3[i]);
		} else {
			apid[i] = g_RemoteControl->current_PIDs.APIDs[i].pid;
			is_ac3[i] = g_RemoteControl->current_PIDs.APIDs[i].is_ac3;
		}
		perc_val[i] = CZapit::getInstance()->GetPidVolume(chan, apid[i], is_ac3[i]);
		perc_str[i] = to_string(perc_val[i]) + "%";

		CMenuForwarder *fw = new CMenuForwarder(is_mp ? mp->getAPIDDesc(i).c_str() : g_RemoteControl->current_PIDs.APIDs[i].desc, 
				true, perc_str[i], this, "s", CRCInput::convertDigitToKey(i + 1));
		fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
		fw->setMarked(sel_apid == i);

		AudioSelector->addItem(fw, sel_apid == i);
	}
	unsigned int shortcut_num = p_count;
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
	if (p_count)
		AudioSelector->addItem(GenericMenuSeparatorLine);

	// -- setup menue for to Dual Channel Stereo
	CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE,
			&g_settings.audio_AnalogMode,
			AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
			true, audioSetupNotifier, CRCInput::RC_red);

	AudioSelector->addItem( oj );

	oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out,
			OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,
			true, audioSetupNotifier, CRCInput::RC_green);
	AudioSelector->addItem( oj );
#endif

	CZapitChannel * cc = NULL;
	int subtitleCount = 0;
	if (is_mp) {
		subtitleCount = mp->getSubtitleCount();
	} else {
		CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
		int curnum = channelList->getActiveChannelNumber();
		cc = channelList->getChannel(curnum);
		subtitleCount = (int)cc->getSubtitleCount();
	}

	bool sep_added = false;
	if (subtitleCount > 0)
	{
		bool sub_active = false;

		for (int i = 0 ; i < subtitleCount ; ++i)
		{
			CZapitAbsSub* s = is_mp ? mp->getChannelSub(i, &s) : cc->getChannelSub(i);
			if (!s)
				continue;

			if (!sep_added)
			{
				sep_added = true;
				AudioSelector->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
			}

			bool ena = false;
			bool add = true;
			char spid[64];
			char item[64];

			if (s->thisSubType == CZapitAbsSub::DVB) {
				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				// printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId);
				snprintf(spid,sizeof(spid), "DVB:%d", sd->pId);
				snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId);
				ena = sd->pId != (is_mp ? mp->getCurrentSubPid(CZapitAbsSub::DVB) : dvbsub_getpid());
			} else if (s->thisSubType == CZapitAbsSub::TTX) {
				CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
				// printf("[neutrino] adding TTX subtitle %s pid %x mag %X page %x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number);
				int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
				int pid = sd->pId;
				snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str());
				snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
				ena = !tuxtx_subtitle_running(&pid, &page, NULL);
			} else if (is_mp && s->thisSubType == CZapitAbsSub::SUB) {
				// printf("[neutrino] adding SUB subtitle %s pid %x\n", s->ISO639_language_code.c_str(), s->pId);
				snprintf(spid,sizeof(spid), "SUB:%d", s->pId);
				snprintf(item,sizeof(item), "SUB: %s (pid %x)", s->ISO639_language_code.c_str(), s->pId);
				ena = s->pId != mp->getCurrentSubPid(CZapitAbsSub::SUB);
			} else
				add = false;

			if (add)
				AudioSelector->addItem(new CMenuForwarder(item, ena,
							NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
			if (is_mp)
				delete s;

			sub_active |= !ena;
		}

		if (sub_active) {
			CMenuForwarder * item = new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop);
			item->setItemButton(NEUTRINO_ICON_BUTTON_STOP, false);
			AudioSelector->addItem(item);
		}
	}

#if 0
	AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST));

	/* setting volume percent to zapit with channel_id/apid = 0 means current channel and pid */
	CVolume::getInstance()->SetCurrentChannel(0);
	CVolume::getInstance()->SetCurrentPid(0);
	int percent[p_count+1];//+1 avoid zero size
	for (uint i=0; i < p_count; i++) {
		percent[i] = CZapit::getInstance()->GetPidVolume(0, g_RemoteControl->current_PIDs.APIDs[i].pid, g_RemoteControl->current_PIDs.APIDs[i].is_ac3);
		AudioSelector.addItem(new CMenuOptionNumberChooser(g_RemoteControl->current_PIDs.APIDs[i].desc,
					&percent[i], i == g_RemoteControl->current_PIDs.PIDs.selected_apid,
					0, 999, CVolume::getInstance()));
	}
#endif

	int res = AudioSelector->exec(NULL, "");

	delete AudioSelector;
	AudioSelector = NULL;

	return res;
}
コード例 #24
0
void CServiceManager::ParseChannels(xmlNodePtr node, const t_transport_stream_id transport_stream_id, const t_original_network_id original_network_id, t_satellite_position satellitePosition, freq_id_t freq)
{
	t_service_id service_id;
	std::string  name;
	uint8_t      service_type;
	unsigned short vpid, apid, pcrpid, pmtpid, txpid, vtype, scrambled;
	std::string desc = "";
	desc += "Preset";
	t_channel_id chid;
	int dummy;
	int * have_ptr = &dummy;

	sat_iterator_t sit = satellitePositions.find(satellitePosition);
	if(sit != satellitePositions.end())
		have_ptr = &sit->second.have_channels;

	while ((node = xmlGetNextOccurence(node, "S")) != NULL) {
		*have_ptr = 1;
		service_id = xmlGetNumericAttribute(node, "i", 16);
		name = xmlGetAttribute(node, "n");
		service_type = xmlGetNumericAttribute(node, "t", 16);
		vpid = xmlGetNumericAttribute(node, "v", 16);
		apid = xmlGetNumericAttribute(node, "a", 16);
		pcrpid = xmlGetNumericAttribute(node, "p", 16);
		pmtpid = xmlGetNumericAttribute(node, "pmt", 16);
		txpid = xmlGetNumericAttribute(node, "tx", 16);
		vtype = xmlGetNumericAttribute(node, "vt", 16);
		scrambled = xmlGetNumericAttribute(node, "s", 16);

		chid = CREATE_CHANNEL_ID64;
		char *ptr = xmlGetAttribute(node, "action");
		bool remove = ptr ? (!strcmp(ptr, "remove") || !strcmp(ptr, "replace")) : false;
		bool add    = ptr ? (!strcmp(ptr, "add")    || !strcmp(ptr, "replace")) : true;
		if (remove) {
			int result = allchans.erase(chid);
			printf("[getservices]: %s '%s' (sid=0x%x): %s", add ? "replacing" : "removing",
					name.c_str(), service_id, result ? "succeded.\n" : "FAILED!\n");
		}
		if(!add) {
			node = node->xmlNextNode;
			continue;
		}
		audio_map_set_t * pidmap = CZapit::getInstance()->GetSavedPids(chid);
		if(pidmap)
			apid = pidmap->apid;

		CZapitChannel * channel = new CZapitChannel ( name, service_id,
				transport_stream_id,
				original_network_id,
				service_type,
				satellitePosition,
				freq);

		bool ret = AddChannel(channel);

		//printf("INS CHANNEL %s %x\n", name.c_str(), (int) &ret.first->second);
		if(ret == false) {
			printf("[zapit] duplicate channel %s id %llx freq %d (old %s at %d)\n",
					name.c_str(), chid, freq, channel->getName().c_str(), channel->getFreqId());
		} else {
			service_count++;
			channel->scrambled = scrambled;
			service_type = channel->getServiceType();
			if(pmtpid != 0 && (((service_type == 2) && (apid > 0)) || ( (service_type == 1)  && (vpid > 0) && (apid > 0))) ) {
				DBG("[getserv] preset chan %s vpid %X sid %X tpid %X onid %X\n", name.c_str(), vpid, service_id, transport_stream_id, transport_stream_id);
				channel->setVideoPid(vpid);
				channel->setAudioPid(apid);
				channel->setPcrPid(pcrpid);
				channel->setPmtPid(pmtpid);
				channel->setTeletextPid(txpid);
				channel->setPidsFlag();
				channel->type = vtype;
			}
		}
		node = node->xmlNextNode;
	}
	return;
}
コード例 #25
0
ファイル: audio_select.cpp プロジェクト: vitmod/neutrinohd2
int CAudioSelectMenuHandler::doMenu()
{
	CMenuWidget AudioSelector(LOCALE_APIDSELECTOR_HEAD, NEUTRINO_ICON_AUDIO);
	
	unsigned int count;
	
	CAPIDChangeExec APIDChanger;
	CSubtitleChangeExec SubtitleChanger;
	
	// audio pids
	for(count = 0; count < g_RemoteControl->current_PIDs.APIDs.size(); count++ ) 
	{
		char apid[5];
		sprintf(apid, "%d", count);
		AudioSelector.addItem(new CMenuForwarder(g_RemoteControl->current_PIDs.APIDs[count].desc, true, NULL, &APIDChanger, apid, CRCInput::convertDigitToKey(count + 1)), (count == g_RemoteControl->current_PIDs.PIDs.selected_apid));
	}

	if(g_RemoteControl->current_PIDs.APIDs.size())
		AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE));

	// analogue output
	AudioSelector.addItem(new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOGOUT, &g_settings.audio_AnalogMode, AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT, true, audioSetupNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
	
	// ac3
#if !defined (PLATFORM_COOLSTREAM)	
	AudioSelector.addItem(new CMenuOptionChooser(LOCALE_AUDIOMENU_HDMI_DD, &g_settings.hdmi_dd, AC3_OPTIONS, AC3_OPTION_COUNT, true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN ));
#endif

	//dvb/tuxtxt subs
	CChannelList * channelList = CNeutrinoApp::getInstance()->channelList;
	int curnum = channelList->getActiveChannelNumber();
	CZapitChannel * cc = channelList->getChannel(curnum);

	bool sep_added = false;
	if(cc) 
	{
		for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i) 
		{
			CZapitAbsSub* s = cc->getChannelSub(i);
			
			//dvbsub
			if (s->thisSubType == CZapitAbsSub::DVB) 
			{
				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				printf("[CAudioSelectMenuHandler] adding DVB subtitle %s pid 0x%x\n", sd->ISO639_language_code.c_str(), sd->pId);
				if(!sep_added) 
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[10];
				//int pid = sd->pId;
				snprintf(spid,sizeof(spid), "DVB:%d", sd->pId);
				char item[64];
				//snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId);
				snprintf(item, sizeof(item), "DVB: %s", sd->ISO639_language_code.c_str());
				AudioSelector.addItem(new CMenuForwarder(item, sd->pId != dvbsub_getpid() /* !dvbsub_getpid(&pid, NULL)*/, NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++count)));
			}
			
			//txtsub
			if (s->thisSubType == CZapitAbsSub::TTX) 
			{
				CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
				printf("[CAudioSelectMenuHandler] adding TTX subtitle %s pid 0x%x mag 0x%X page 0x%x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number);
				if(!sep_added) 
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[64];
				int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
				int pid = sd->pId;
				snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str()); 
				char item[64];
				//snprintf(item, sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
				snprintf(item, sizeof(item), "TTX: %s", sd->ISO639_language_code.c_str());
				AudioSelector.addItem(new CMenuForwarder(item,  !tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++count)));
			}
		}
		
		if(sep_added) 
		{
			AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE));
			AudioSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ));
		}

	}
	
	// volume percent
	int percent[g_RemoteControl->current_PIDs.APIDs.size()];
	
	for(count = 0; count < g_RemoteControl->current_PIDs.APIDs.size(); count++ ) 
	{
		g_Zapit->getVolumePercent((unsigned int *) &percent[count], 0, g_RemoteControl->current_PIDs.APIDs[count].pid);
		int is_active = count == g_RemoteControl->current_PIDs.PIDs.selected_apid;
		
		if(!sep_added) 
		{
			sep_added = true;
			AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST));
		}
		
		AudioSelector.addItem(new CMenuOptionNumberChooser(NONEXISTANT_LOCALE, &percent[count],
			is_active,
			0, 100, audioSetupNotifierVolPercent, 0, 0, NONEXISTANT_LOCALE,
			g_RemoteControl->current_PIDs.APIDs[count].desc));
	}

	return AudioSelector.exec(NULL, "");
}
コード例 #26
0
int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t data, int &msgret, bool from_menu)
{
	char str[255];
	char cnt[5];
	int i;
	MMI_MENU_LIST_INFO Menu;
	MMI_ENQUIRY_INFO MmiEnquiry;
	MMI_MENU_LIST_INFO *pMenu = &Menu;
	MMI_ENQUIRY_INFO *pMmiEnquiry = &MmiEnquiry;
	CA_MESSAGE Msg, *rMsg;

	//printf("CCAMMenuHandler::handleCamMsg: msg %x data %x from %s\n", msg, data, from_menu ? "menu" : "neutrino");
	msgret = messages_return::unhandled;

	if ((msg == NeutrinoMessages::EVT_TIMER) && (data == close_timer)) {
		printf("CCAMMenuHandler::handleCamMsg: EVT_TIMER close_timer %d\n", close_timer);
		g_RCInput->killTimer(close_timer);
		msgret = messages_return::cancel_info;
	}

	if (msg != NeutrinoMessages::EVT_CA_MESSAGE)
		return 1;

	msgret = messages_return::handled;

	rMsg	= (CA_MESSAGE *)data;
	if (!rMsg)
		return -1;

	Msg = *rMsg;
	delete rMsg;

	u32 MsgId             = Msg.MsgId;
	CA_SLOT_TYPE SlotType = Msg.SlotType;
	int curslot           = Msg.Slot;

	printf("CCAMMenuHandler::handleCamMsg: CA msg %x from %s\n", MsgId, from_menu ? "menu" : "neutrino");

	if (g_settings.ci_ignore_messages && !from_menu)
		return 1;

	hideHintBox();

	if (SlotType != CA_SLOT_TYPE_SMARTCARD && SlotType != CA_SLOT_TYPE_CI)
		return -1;

	if(MsgId == CA_MESSAGE_MSG_INSERTED) {
		snprintf(str, sizeof(str), "%s %d", 
				g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INSERTED : LOCALE_SC_INSERTED), (int)curslot+1);
		printf("CCAMMenuHandler::handleCamMsg: %s\n", str);
		ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3);
		if (in_menu)
			msgret = messages_return::cancel_all;
	} else if (MsgId == CA_MESSAGE_MSG_REMOVED) {
		snprintf(str, sizeof(str), "%s %d", 
				g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_REMOVED : LOCALE_SC_REMOVED), (int)curslot+1);

		printf("CCAMMenuHandler::handleCamMsg: %s\n", str);
		ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3);
#if 0
		if (menu_slot == curslot && menu_type == SlotType)
			return 3;
#endif
		if (in_menu)
			msgret = messages_return::cancel_all;
	} else if(MsgId == CA_MESSAGE_MSG_INIT_OK) {
		char name[255] = "Unknown";
		if (ca)
			ca->ModuleName(SlotType, curslot, name);

		snprintf(str, sizeof(str), "%s %d: %s", 
				g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name);
		printf("CCAMMenuHandler::handleCamMsg: %s\n", str);
		CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true);
		ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3);
	} else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) {
		char name[255] = "Unknown";
		if (ca)
			ca->ModuleName(SlotType, curslot, name);

		snprintf(str, sizeof(str), "%s %d: %s", 
				g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name);

		printf("CCAMMenuHandler::handleCamMsg: %s\n", str);
		ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3);
	} else if(MsgId == CA_MESSAGE_MSG_MMI_MENU || MsgId == CA_MESSAGE_MSG_MMI_LIST) {
		bool sublevel = false;

		if(MsgId != CA_MESSAGE_MSG_MMI_MENU)
			sublevel = true;

		if (!(Msg.Flags & CA_MESSAGE_HAS_PARAM1_DATA))
			return -1;

		memmove(pMenu, (MMI_MENU_LIST_INFO*)Msg.Msg.Data[0], sizeof(MMI_MENU_LIST_INFO));
		free((void *)Msg.Msg.Data[0]);

		printf("CCAMMenuHandler::handleCamMsg: slot %d menu ready, title %s choices %d\n", curslot, convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), pMenu->choice_nb);

		int menuret = menu_return::RETURN_REPAINT;
		int selected = -1;
		if(pMenu->choice_nb && from_menu) {
			CMenuWidget* menu = new CMenuWidget(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), NEUTRINO_ICON_SETTINGS);
			menu->enableSaveScreen(true);

			CMenuSelectorTarget * selector = new CMenuSelectorTarget(&selected);
			int slen = strlen(pMenu->subtitle);
			if(slen) {
				char * sptr = pMenu->subtitle;
				char * tptr = sptr;
				int bpos = 0;
				for(int li = 0; li < slen; li++) {
					if((tptr[li] == 0x8A) || ((bpos > 38) && (tptr[li] == 0x20)) ) {
						bpos = 0;
						tptr[li] = 0;
						printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr);
						menu->addItem(new CMenuForwarder(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false));
						sptr = &tptr[li+1];
					}
					bpos++;
				}
				if(strlen(sptr)) {
					printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr);
					menu->addItem(new CMenuForwarder(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false));
				}
			}
			for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) {
				snprintf(cnt, sizeof(cnt), "%d", i);
				if(sublevel)
					menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt));
				else
					menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i+1)));
			}
			slen = strlen(pMenu->bottom);
			if(slen) {
				printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom);
				menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false));
			}

			menuret = menu->exec(NULL, "");
			delete menu;
			delete selector;
		} else {

			char lstr[255];
			int slen = 0;

			if(strlen(pMenu->title))
				slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->title);
			if(strlen(pMenu->subtitle))
				slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->subtitle);
			if(strlen(pMenu->bottom))
				slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->bottom);

			for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++)
				slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->choice_item[i]);

			ShowHint(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str());
			return 0;
		}

		if(sublevel)
			return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 0;

		if(selected >= 0) {
			printf("CCAMMenuHandler::handleCamMsg: selected %d:%s sublevel %s\n", selected, pMenu->choice_item[i], sublevel ? "yes" : "no");
			ca->MenuAnswer(SlotType, curslot, selected+1);
			timeoutEnd = CRCInput::calcTimeoutEnd(10);
			return 1;
		} else {
			return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 2;
		}
	}
	else if(MsgId == CA_MESSAGE_MSG_MMI_REQ_INPUT) {
		if (!(Msg.Flags & CA_MESSAGE_HAS_PARAM1_DATA))
			return -1;

		memmove(pMmiEnquiry, (MMI_ENQUIRY_INFO *)Msg.Msg.Data[0], sizeof(MMI_ENQUIRY_INFO));
		free((void *)Msg.Msg.Data[0]);
		printf("CCAMMenuHandler::handleCamMsg: slot %d input request, text %s\n", curslot, convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str());

		std::string ENQAnswer;

		if (/* !from_menu && */ g_settings.ci_save_pincode && pMmiEnquiry->blind != 0 && (int) g_settings.ci_pincode.length() == pMmiEnquiry->answerlen) {
			static int acount = 0;
			static time_t last_ask = 0;

			ENQAnswer = g_settings.ci_pincode;
			printf("CCAMMenuHandler::handleCamMsg: using saved answer [%s] (#%d, time diff %d)\n", ENQAnswer.c_str(), acount, (int) (time_monotonic() - last_ask));
			if ((time_monotonic() - last_ask) < 10) {
				acount++;
				if (acount > 4)
					g_settings.ci_pincode.clear();
			} else {
				last_ask = time_monotonic();
				acount = 0;
			}
		} else {
			CEnquiryInput *Inquiry = new CEnquiryInput((char *)convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str(), &ENQAnswer, pMmiEnquiry->answerlen, pMmiEnquiry->blind != 0, NONEXISTANT_LOCALE);
			Inquiry->exec(NULL, "");
			delete Inquiry;
			g_settings.ci_pincode = ENQAnswer;
		}

		printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", ENQAnswer.c_str());

		if((int) ENQAnswer.length() != pMmiEnquiry->answerlen) {
			printf("CCAMMenuHandler::handleCamMsg: wrong input len\n");
			ca->InputAnswer(SlotType, curslot, (unsigned char *)ENQAnswer.c_str(), 0);
			return 1; //FIXME
		} else {
			ca->InputAnswer(SlotType, curslot, (unsigned char *)ENQAnswer.c_str(), pMmiEnquiry->answerlen);
			return 1;
		}
	}
	else if(MsgId == CA_MESSAGE_MSG_MMI_CLOSE) {
		int timeout = 0;
		if (Msg.Flags & CA_MESSAGE_HAS_PARAM1_INT)
			timeout = Msg.Msg.Param[0];
		printf("CCAMMenuHandler::handleCamMsg: close request slot: %d (timeout %d)\n", curslot, timeout);
		//ca->MenuClose(SlotType, curslot);
		if (timeout)
			close_timer = g_RCInput->addTimer(timeout*1000*1000, true);
		else
			msgret = messages_return::cancel_info;
		return 0;
	}
	else if(MsgId == CA_MESSAGE_MSG_MMI_TEXT) {
		printf("CCAMMenuHandler::handleCamMsg: text\n");
	}
	else if(MsgId == CA_MESSAGE_MSG_CHANNEL_CHANGE) {
		if (!(Msg.Flags & CA_MESSAGE_HAS_PARAM1_LONG))
			return -1;

		t_channel_id chid = Msg.Msg.ParamLong[0];
		printf("CCAMMenuHandler::handleCamMsg: CA_MESSAGE_MSG_CHANNEL_CHANGE: %" PRIx64 "\n", chid);
		CZapitChannel * channel = CServiceManager::getInstance()->FindChannel48(chid);
		if (!channel) {
			printf("CCAMMenuHandler::handleCamMsg: channel %" PRIx64 "not found\n", chid);
			return -1;
		}
		CNeutrinoApp::getInstance()->zapTo(channel->getChannelID());
	} 
	return 1;
}
コード例 #27
0
ファイル: bouquets.cpp プロジェクト: silid/tuxbox-cvs-apps
void CBouquetManager::parseBouquetsXml(const xmlNodePtr root)
{
	extern CConfigFile config;
	bool channel_names_from_bouquet = config.getBool("ChannelNamesFromBouquet", false);

	xmlNodePtr search=root->xmlChildrenNode;
	xmlNodePtr channel_node;

	if (search)
	{
		t_original_network_id original_network_id;
		t_service_id          service_id;
		t_transport_stream_id transport_stream_id;
		t_satellite_position  satellitePosition;

		INFO("reading bouquets");

		while ((search = xmlGetNextOccurence(search, "Bouquet")) != NULL)
		{
			CBouquet *newBouquet;
			char *name = xmlGetAttribute(search, "name");
			int bnum = existsBouquet(name);
			if (bnum != -1)
				newBouquet = Bouquets[bnum];
			else
			{
				newBouquet = addBouquet(name);
				char* hidden = xmlGetAttribute(search, "hidden");
				char* locked = xmlGetAttribute(search, "locked");
				newBouquet->type = xmlGetNumericAttribute(search, "type", 16);
				newBouquet->bouquet_id = xmlGetNumericAttribute(search, "bouquet_id", 16);
				newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false;
				newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false;
				bnum = Bouquets.size() - 1;
			}

			channel_node = search->xmlChildrenNode;
			while ((channel_node = xmlGetNextOccurence(channel_node, "channel")) != NULL)
			{
				GET_ATTR(channel_node, "serviceID", SCANF_SERVICE_ID_TYPE, service_id);
				GET_ATTR(channel_node, "onid", SCANF_ORIGINAL_NETWORK_ID_TYPE, original_network_id);
				GET_ATTR(channel_node, "sat", SCANF_SATELLITE_POSITION_TYPE, satellitePosition);
				GET_ATTR(channel_node, "tsid", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id);

				CZapitChannel* chan = findChannelByChannelID(CREATE_CHANNEL_ID);

				if (chan != NULL) {
					if (channel_names_from_bouquet)
						chan->setName(xmlGetAttribute(channel_node, "name"));

					if (existsChannelInBouquet(bnum, CREATE_CHANNEL_ID)) {
						DBG("b %d '%s' ch %012llx sat %3d name '%s' exists, not added",
						    bnum, name, CREATE_CHANNEL_ID, satellitePosition,
						    chan->getName().c_str());
					} else
						newBouquet->addService(chan);
				}

				channel_node = channel_node->xmlNextNode;
			}

			search = search->xmlNextNode;
		}
	
		INFO("found %d bouquets", Bouquets.size());
	}

}
コード例 #28
0
//-------------------------------------------------------------------------
// y-func : get_audio_pids_as_dropdown (from controlapi)
// prara: [apid] option value = apid-Value. Default apid-Index
//-------------------------------------------------------------------------
std::string  CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, std::string para)
{
	std::string yresult;
	static bool init_iso=true;
	bool idx_as_id=true;
	unsigned int selected_apid = 0;
	t_channel_id current_channel_id = 0;
	CZapitChannel * channel = NULL;
	if(para == "apid")
		idx_as_id=false;
	else if(!para.empty() && ("channel="== para.substr(0,8))){
		if (sscanf(para.c_str(), "channel=%" SCNx64 ":audio=%i:", &current_channel_id,&selected_apid) == 2) {
			if(current_channel_id != 0 && CZapit::getInstance()->GetCurrentChannelID() != current_channel_id){
				channel = CServiceManager::getInstance()->FindChannel(current_channel_id);
			}
		}
	}
	if(init_iso)
	{
		if(_initialize_iso639_map())
			init_iso=false;
	}
	if (channel){//check audio pid if current_channel != vlc live channel
		//wait for channel lock
		for (int i = 0; i < 30 && channel->getAudioChannelCount()==0;i++){
			usleep(100000);
		}
		for (unsigned int i = 0; i <  channel->getAudioChannelCount(); i++) {
			CZapitAudioChannel::ZapitAudioChannelType atype = channel->getAudioChannel(i)->audioChannelType;
			std::string a_desc;
			if(!(init_iso)){
				a_desc = _getISO639Description( channel->getAudioChannel(i)->description.c_str() );
			}else{
				a_desc = channel->getAudioChannel(i)->description.c_str();
			}
			if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) {
				yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",i
				, (i==selected_apid) ? "selected=\"selected\"" : ""
				, a_desc.c_str()
				,"(EAC3)");
			} else {
				yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",i
				, (i==selected_apid) ? "selected=\"selected\"" : ""
				,a_desc.c_str()
				,atype?"(AC3)":" ");
			}
		}
	}
	if( yresult.empty()){
		bool eit_not_ok=true;
		if(current_channel_id==0)
			current_channel_id = CZapit::getInstance()->GetCurrentChannelID();

		CZapitClient::responseGetPIDs pids;
		CSectionsdClient::ComponentTagList tags;
		pids.PIDs.vpid=0;
		NeutrinoAPI->Zapit->getPIDS(pids);

		CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
		CEitManager::getInstance()->getCurrentNextServiceKey(current_channel_id, currentNextInfo);
		if (CEitManager::getInstance()->getComponentTagsUniqueKey(currentNextInfo.current_uniqueKey,tags))
		{
			unsigned int tag = 0;
			for (unsigned int i=0; i< tags.size(); i++)
			{
				for (unsigned short j=0; j< pids.APIDs.size(); j++)
				{
					if ( pids.APIDs[j].component_tag == tags[i].componentTag )
					{
						if(!tags[i].component.empty())
						{
							if(!(isalnum(tags[i].component[0])))
								tags[i].component=tags[i].component.substr(1,tags[i].component.length()-1);
							yresult += string_printf("<option value=%05u %s>%s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,(tag==selected_apid) ? "selected=\"selected\"" : "",tags[i].component.c_str());
							tag++;
						}
						else
						{
							if(!(init_iso))
							{
								strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) );
							}
							yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,(j==selected_apid) ? "selected=\"selected\"" : "",std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": pids.APIDs[j].is_aac ? "(AAC)" : pids.APIDs[j].is_eac3 ? "(EAC3)" : " ");
						}
						eit_not_ok=false;
						break;
					}
				}
			}
		}
		if(eit_not_ok)
		{
			unsigned short i = 0;
			for (CZapitClient::APIDList::iterator it = pids.APIDs.begin(); it!=pids.APIDs.end(); ++it)
			{
				if(!(init_iso))
				{
					strcpy( pids.APIDs[i].desc, _getISO639Description( pids.APIDs[i].desc ) );
				}
				yresult += string_printf("<option value=%05u %s>%s %s</option>\r\n",
							 idx_as_id ? i : it->pid, (i==selected_apid) ? "selected=\"selected\"" : "",pids.APIDs[i].desc,
							 pids.APIDs[i].is_ac3 ? " (AC3)": pids.APIDs[i].is_aac ? "(AAC)" : pids.APIDs[i].is_eac3 ? "(EAC3)" : " ");
				i++;
			}
		}
		if(pids.APIDs.empty())
			yresult = "00000"; // shouldnt happen, but print at least one apid
	}
	return yresult;
}
コード例 #29
0
ファイル: streamts.cpp プロジェクト: Coolstreamto/Coolto
bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid)
{
	char cbuf[512];
	char *bp;

	FILE * fp = fdopen(fd, "r+");
	if(fp == NULL) {
		perror("fdopen");
		return false;
	}
	cbuf[0] = 0;
	bp = &cbuf[0];

	/* read one line */
	while (bp - &cbuf[0] < (int) sizeof(cbuf)) {
		unsigned char c;
		int res = read(fd, &c, 1);
		if(res < 0) {
			perror("read");
			return false;
		}
		if ((*bp++ = c) == '\n')
			break;
	}

	*bp++ = 0;
	bp = &cbuf[0];

	printf("CStreamManager::Parse: got %s\n", cbuf);

	/* send response to http client */
	if (!strncmp(cbuf, "GET /", 5)) {
		fprintf(fp, "HTTP/1.1 200 OK\r\nServer: streamts (%s)\r\n\r\n", "ts" /*&argv[1][1]*/);
		fflush(fp);
		bp += 5;
	} else {
		printf("Received garbage\n");
		return false;
	}

#ifndef ENABLE_MULTI_CHANNEL
	/* parse stdin / url path, start dmx filters */
	do {
		int pid;
		int res = sscanf(bp, "%x", &pid);
		if(res == 1) {
			printf("New pid: 0x%x\n", pid);
			pids.insert(pid);
		}
	}
	while ((bp = strchr(bp, ',')) && (bp++));
#endif

	chid = CZapit::getInstance()->GetCurrentChannelID();
	CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();

	int mode = CNeutrinoApp::getInstance()->getMode();
	if (mode == NeutrinoMessages::mode_standby && streams.empty()) {
		printf("CStreamManager::Parse: wakeup zapit..\n");
		cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
		g_Zapit->setStandby(false);
		g_Zapit->getMode();
	}
	if(pids.empty()) {
#ifdef ENABLE_MULTI_CHANNEL
		t_channel_id tmpid;
		bp = &cbuf[5];
		if (sscanf(bp, "id=%llx", &tmpid) == 1) {
			printf("############################# channel_id %llx\n", tmpid);

			CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(tmpid);
			if (tmpchan && (tmpid != chid) && SAME_TRANSPONDER(tmpid, chid)) {
				printf("############################# channel_id %llx -> zap\n", tmpid);
				bool ret = g_Zapit->zapTo_record(tmpid) > 0;
				if (ret) {
					channel = tmpchan;
					chid = tmpid;
				}
			}
		}
		if(CRecordManager::getInstance()->RecordingStatus(chid)) {
			printf("CStreamManager::Parse: channel %llx recorded, aborting..\n", chid);
			return false;
		}
#ifdef ENABLE_PIP
		t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID();
		if ((chid == pip_channel_id) && (channel->getRecordDemux() == channel->getPipDemux())) {
			printf("CStreamManager::Parse: channel %llx used for pip, aborting..\n", chid);
			return false;
		}
#endif
#endif

		printf("CStreamManager::Parse: no pids in url, using channel %llx pids\n", chid);
		if(!channel)
			return false;
		//pids.insert(0);
		//pids.insert(channel->getPmtPid());
		pids.insert(channel->getVideoPid());
		for (int i = 0; i <  channel->getAudioChannelCount(); i++)
			pids.insert(channel->getAudioChannel(i)->pid);

	}
	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);
			psi.addPid(*it, channel->type ? EN_TYPE_AVC : 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);
					if(channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3){
						psi.addPid(*it, EN_TYPE_AUDIO_EAC3, atype, channel->getAudioChannel(i)->description.c_str());
					}else{
						psi.addPid(*it, EN_TYPE_AUDIO, atype, channel->getAudioChannel(i)->description.c_str());
					}
				}
			}
		}
	}
	//add pcr pid
	if(channel->getPcrPid() != channel->getVideoPid()){
		pids.insert(channel->getPcrPid());
		psi.addPid(channel->getPcrPid(), EN_TYPE_PCR, 0);
	}
	//add teletext pid
	if (g_settings.recording_stream_vtxt_pid && channel->getTeletextPid() != 0){
		pids.insert(channel->getTeletextPid());
		psi.addPid(channel->getTeletextPid(), EN_TYPE_TELTEX, 0, channel->getTeletextLang());
	}
	//add dvb sub pid
	if (g_settings.recording_stream_subtitle_pids){
		for (int i = 0 ; i < (int)channel->getSubtitleCount() ; ++i) {
			CZapitAbsSub* s = channel->getChannelSub(i);
			if (s->thisSubType == CZapitAbsSub::DVB) {
				if(i>9)//max sub pids
					break;

				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				pids.insert(sd->pId);
				psi.addPid( sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str() );
			}
		}

	}

	psi.genpsi(fd);

	return !pids.empty();
}
コード例 #30
0
int CAudioSelectMenuHandler::doMenu ()
{
	CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);

	CSubtitleChangeExec SubtitleChanger;
	
	//show cancel button if configured in usermenu settings
	if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
		AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
	else
		AudioSelector.addItem(GenericMenuSeparator);

	unsigned int shortcut_num = 1;

	// -- setup menue due to Audio PIDs
	if (g_RemoteControl->current_PIDs.APIDs.size() > 1) 
	{
		uint p_count = g_RemoteControl->current_PIDs.APIDs.size();
		CMenuForwarderNonLocalized* fw[p_count];

	  	for( uint i=0; i < p_count; i++ ) 
		{
			char apid[5];
			sprintf(apid, "%d", i);
			fw[i] = new CMenuForwarderNonLocalized(g_RemoteControl->current_PIDs.APIDs[i].desc, true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1));
			fw[i]->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
			AudioSelector.addItem(fw[i], (i == g_RemoteControl->current_PIDs.PIDs.selected_apid));
			shortcut_num = i+1;
	   	}
	   	AudioSelector.addItem(GenericMenuSeparatorLine);
	}
		
	// -- setup menue for to Dual Channel Stereo
	CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE,
				&g_settings.audio_AnalogMode,
				AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
			true, audioSetupNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);

	AudioSelector.addItem( oj );

#ifndef EVOLUX // should be: HAVE_SPARK_HARDWARE
	oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out,
			 OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, 
			true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);

	AudioSelector.addItem( oj );
#endif

	CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
	int curnum = channelList->getActiveChannelNumber();
	CZapitChannel * cc = channelList->getChannel(curnum);

	bool sep_added = false;
	if(cc) 
	{
		for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i) 
		{
			CZapitAbsSub* s = cc->getChannelSub(i);
			if (s->thisSubType == CZapitAbsSub::DVB) {
				CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
				printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId);
				if(!sep_added) 
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[10];
				snprintf(spid,sizeof(spid), "DVB:%d", sd->pId);
				char item[64];
				snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId);
				AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
							sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
			}
			if (s->thisSubType == CZapitAbsSub::TTX) 
			{
				CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
				printf("[neutrino] adding TTX subtitle %s pid %x mag %X page %x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number);
				if(!sep_added) 
				{
					sep_added = true;
					AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
				}
				char spid[64];
				int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
				int pid = sd->pId;
				snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str()); 
				char item[64];
				snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
				AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
							!tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
			}
		}
		
		if(sep_added) 
			AudioSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop));
	}

#ifdef EVOLUX
	AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUSTMENT));

	int percent[g_RemoteControl->current_PIDs.APIDs.size()];
	audioSetupNotifierVolPercent->setChannelId(0);
	audioSetupNotifierVolPercent->setAPid(0);
	for(unsigned int count = 0; count < g_RemoteControl->current_PIDs.APIDs.size(); count++ ) {
		g_Zapit->getVolumePercent((unsigned int *) &percent[count], 0, g_RemoteControl->current_PIDs.APIDs[count].pid);
		int is_active = count == g_RemoteControl->current_PIDs.PIDs.selected_apid;
		AudioSelector.addItem(new CMenuOptionNumberChooser(NONEXISTANT_LOCALE, &percent[count],
			is_active,
			0, 999, audioSetupNotifierVolPercent, 0, 0, NONEXISTANT_LOCALE,
			g_RemoteControl->current_PIDs.APIDs[count].desc));
		if (is_active)
			g_settings.current_volume_percent = percent[count];
	}
#endif
	return AudioSelector.exec(NULL, "");
}