driver/record.cpp: save added pids from pmt update;

add safe-check for max pids recorded
This commit is contained in:
[CST] Focus
2013-11-11 14:04:59 +04:00
parent 74245afd0d
commit 545f1dee6a

View File

@@ -175,8 +175,11 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str());
}else }else
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str());
if (numpids >= REC_MAX_APIDS)
break;
} }
if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){ if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0) && (numpids < REC_MAX_APIDS)){
apids[numpids++] = allpids.PIDs.vtxtpid; apids[numpids++] = allpids.PIDs.vtxtpid;
psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang()); psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang());
} }
@@ -186,6 +189,8 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
if (s->thisSubType == CZapitAbsSub::DVB) { if (s->thisSubType == CZapitAbsSub::DVB) {
if(i>9)//max sub pids if(i>9)//max sub pids
break; break;
if (numpids >= REC_MAX_APIDS)
break;
CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s); CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
apids[numpids++] = sd->pId; apids[numpids++] = sd->pId;
@@ -196,9 +201,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
} }
psi.genpsi(fd); psi.genpsi(fd);
#if 0
if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0)) if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0) && (numpids < REC_MAX_APIDS))
apids[numpids++] = allpids.PIDs.pmtpid; apids[numpids++] = allpids.PIDs.pmtpid;
#endif
if(record == NULL) if(record == NULL)
record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/); record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/);
@@ -317,6 +323,9 @@ bool CRecordInstance::Update()
if(!found) { if(!found) {
update = true; update = true;
printf("%s: apid %x not found in recording pids\n", __FUNCTION__, it->apid); printf("%s: apid %x not found in recording pids\n", __FUNCTION__, it->apid);
if (numpids < REC_MAX_APIDS)
apids[numpids++] = it->apid;
record->AddPid(it->apid); record->AddPid(it->apid);
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if(allpids.APIDs[i].pid == it->apid) { if(allpids.APIDs[i].pid == it->apid) {