Пример #1
0
int channels::getChannelNumber(int TS, int ONID, int SID)
{
	//printf("Wanted: TS: %x - ONID: %x - SID: %x\n", TS, ONID, SID);


	//printf ("Found: %d\n",  services_list.count(SID));

	std::pair<std::multimap<int, int>::iterator, std::multimap<int, int>::iterator> ip = services_list.equal_range(SID);
	for (std::multimap<int, int>::iterator it = ip.first; it != ip.second; ++it)
	{
		int pos = (*it).second;
		setCurrentChannel(pos);
		//printf("Checking Position %d - TS: %x - ONID: %x\n", pos, getCurrentTS(), getCurrentONID());
		if (getCurrentTS() == TS && getCurrentONID() == ONID)
			return pos;

	}

	return -1;
}
Пример #2
0
void channels::zapCurrentChannel()
{
	//zap_obj->zap_allstop();

	linkage_perspectives.clear();

	current_mode = CHANNEL;

	zap_obj->stop();

	if (tune(getCurrentTS(), getCurrentONID()))
	{

		fprintf(stderr, "Getting pat\n");
		pat_obj->readPAT();
		fprintf(stderr, "Got it\n");
	
		ECM = 0;
	
		apid = 0;
	
		int tmp_pmt = pat_obj->getPMT(getCurrentSID());
	
		if (tmp_pmt != 0)
		{
			setCurrentPMT(pat_obj->getPMT(getCurrentSID()));
			
			fprintf(stderr, "Getting pmt\n");
			pmt_data pmt_entry = (pmt_obj->readPMT(getCurrentPMT()));
			fprintf(stderr, "Got it\n");
			
			setCurrentPMTdata(pmt_entry);
			deleteCurrentAPIDs();
			number_components = 0;
			video_component = 0;
			for (int i = 0; i < pmt_entry.pid_counter; i++)
			{
				if (pmt_entry.type[i] == 0x02)
				{
					setCurrentVPID(pmt_entry.PID[i]);
					video_component = pmt_entry.component[i];
				}
				else if (pmt_entry.type[i] == 0x04 || pmt_entry.type[i] == 0x03)
				{
					addCurrentAPID(pmt_entry.PID[i]);
					component[number_components++] = pmt_entry.component[i];
				}
				else if (pmt_entry.type[i] == 0x06 && pmt_entry.subtype[i] == 1)
				{
					setCurrentTXT(pmt_entry.PID[i]);
				}
				else if (pmt_entry.type[i] == 0x06 && pmt_entry.subtype[i] != 1)
				{
					addCurrentAPID(pmt_entry.PID[i], (bool) true);
					component[number_components++] = pmt_entry.component[i];
				}
			
				//printf("type: %d - PID: %04x\n", pmt_entry.type[i], pmt_entry.PID[i]);
			}
		
				for (int i = 0; i < pmt_entry.ecm_counter; i++)
			{
				if (setting->getCAID() == pmt_entry.CAID[i])
					ECM = pmt_entry.ECM[i];
				//printf("CAID: %04x - ECM: %04x\n", pmt_entry.CAID[i], pmt_entry.ECM[i]);
			}
			basic_channellist[cur_pos].PCR = pmt_entry.PCR;
		
			hardware_obj->useDD(getCurrentDD(0));
			if (getCurrentAPIDcount() == 1)
				(*zap_obj).zap_to(pmt_entry, getCurrentVPID(), getCurrentAPID(0), getCurrentPCR(), ECM, getCurrentSID(), getCurrentONID(), getCurrentTS());
			else
				(*zap_obj).zap_to(pmt_entry, getCurrentVPID(), getCurrentAPID(0), getCurrentPCR(), ECM, getCurrentSID(), getCurrentONID(), getCurrentTS(), getCurrentAPID(1));
			
			
			if (getCurrentAPIDcount() > 1)
				(*eit_obj).setAudioComponent(component[apid]);
			else
				(*eit_obj).setAudioComponent(-1);
			}
	
		if (getCurrentType() == 4)
		{
			vars->setvalue("%IS_NVOD", "true");
			osd_obj->setNVODAvailable(true);
		}
		else 
		{
			vars->setvalue("%IS_NVOD", "false");
			osd_obj->setNVODAvailable(false);
		}

		last_channels.push(cur_pos);
		int number_last_chans = 2;
		if (vars->isavailable("%NUMBERLASTCHANNELS"))
		{
			number_last_chans = atoi(vars->getvalue("%NUMBERLASTCHANNELS").c_str());
		}
		if (last_channels.size() > (unsigned int) number_last_chans)
		{
			last_channels.pop();
		}
	}
}
Пример #3
0
p_npaspuskForm::p_npaspuskForm(bool AddEdit, int recnum, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::p_npaspuskForm)
{
    ui->setupUi(this);
    // Соединяем сигналы со слотами:
    connect (ui->buttonBox, SIGNAL(accepted()), this, SLOT (SaveRecord()));    //кнопка "Ok"
    connect (ui->buttonBox, SIGNAL(rejected()), this, SLOT (CloseWindow()));  // кнопка "Закрыть"


    // Грузим установки формы из конфигурационного файла
    qTC->formLoad(this, FormSetFile, false);


    // Если жобавляем новую запись, то идем сюда
    if (AddEdit == true)
    {
        QString tmpString = tr("Новое погружение ");
        setWindowTitle(tmpString.append(getCurrentTS().typeTS));

        //Наименование ТС
        ui->labelTSName->setText(getCurrentTS().nameTS);

         // Найдем макс № погружения и услужливо подставим его
        // Если при вычислении max индекса возникла ошибка, ф-ция возвращает '-1'
        int maxInt = MaxCode("z18_spts.p_sgaspusk","nomp");

        // Если почему-то max № не выбрался - пишем в Edit '1'
        if (maxInt == -1)
        {
            ui->lineEditNumber->setText("1");
        }
        else
        {
          maxInt++;
          ui->lineEditNumber->setText(QString::number(maxInt));
        }

        // берем текущую дату
        QDate curdate = QDate::currentDate();
        ui->dateEditPogruzh->clear();
        ui->dateEditPogruzh->setDate(curdate);

        // берем текущее время
        QTime curtime = QTime::currentTime();
        ui->timeEditStartPogruzh->clear();
        ui->timeEditStartPogruzh->setTime(curtime);


    }

    else  // Если редактируем существующую запись, то идем сюда

    {

  /*      QSqlQuery QPogruzh;
        //                value:  0    1    2    3      4         5         6    7
        QPogruzh.prepare("SELECT code,name,nomp,datep,begintime,endtime,codesh,prizn FROM z18_spts.p_sgapred WHERE code = :precnum");
        QPogruzh.bindValue(":precnum",recnum);
        if (!QPogruzh.exec())
        {
            QMessageBox::critical(0, tr("Редактирование записи"), msgErrorOpenEditRecord.toLatin1(), QMessageBox::Ok);
            CloseWindow();
        }

        QPogruzh.first();

        QString tmpString = tr("Погружение №").append(QPogruzh.value(2).toString());
        setWindowTitle(tmpString);

        ui->labelTSName->setText(getCurrentTS().nameTS);

        ui->lineEditNumber->setText(QPogruzh.value(2).toString());

        // берем дату погружения из записи
        QDate pogrdate = QPogruzh.value(3).toDate();
        ui->dateEditPogruzh->clear();
        ui->dateEditPogruzh->setDate(pogrdate);

        // берем время начала из записи
        QTime pogrstarttime = QPogruzh.value(4).toTime();
        ui->timeEditStartPogruzh->clear();
        ui->timeEditStartPogruzh->setTime(pogrstarttime);

        // берем время конца из записи
        QTime pogrendtime = QPogruzh.value(5).toTime();
        ui->timeEditEndPogruzh->clear();
        ui->timeEditEndPogruzh->setTime(pogrendtime);

        // Готов или не готов
        bool YesNoReady = QPogruzh.value(7).toBool();
        if (YesNoReady == false)
        {
            ui->sostLabel->setText(tr("Не готов"));
            ui->sostLabel->setPalette(QPalette(getNotReadyColor()));
        }
        else
        {
            ui->sostLabel->setText(tr("Готов"));
            ui->sostLabel->setPalette(QPalette(getReadyColor()));
        }
*/

    }



}