mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
genpsi: add pcr pid handling
This commit is contained in:
@@ -126,6 +126,7 @@ CGenPsi::CGenPsi()
|
||||
vpid = 0;
|
||||
vtype = 0;
|
||||
|
||||
pcrpid=0;
|
||||
vtxtpid = 0;
|
||||
vtxtlang[0] = 'g';
|
||||
vtxtlang[1] = 'e';
|
||||
@@ -160,9 +161,12 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *da
|
||||
switch(pidtype)
|
||||
{
|
||||
case EN_TYPE_VIDEO:
|
||||
vpid=pid;
|
||||
pcrpid=vpid=pid;
|
||||
vtype = ES_TYPE_MPEG12;
|
||||
break;
|
||||
case EN_TYPE_PCR:
|
||||
pcrpid=pid;
|
||||
break;
|
||||
case EN_TYPE_AVC:
|
||||
vpid=pid;
|
||||
vtype = ES_TYPE_AVC;
|
||||
@@ -243,9 +247,9 @@ int CGenPsi::genpsi(int fd)
|
||||
}
|
||||
//-- write row with desc. for pcr stream (eq. video) --
|
||||
pkt[ofs] = EN_TYPE_PCR;
|
||||
pkt[ofs+1] = 0x02;
|
||||
pkt[ofs+2] = (vpid>>8);
|
||||
pkt[ofs+3] = (vpid & 0xFF);
|
||||
pkt[ofs+1] = 0x02;//vtype ???
|
||||
pkt[ofs+2] = (pcrpid>>8);
|
||||
pkt[ofs+3] = (pcrpid & 0xFF);
|
||||
|
||||
//-- calculate CRC --
|
||||
calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 );
|
||||
@@ -276,8 +280,8 @@ int CGenPsi::genpsi(int fd)
|
||||
pkt[OFS_HDR_2+2] = (patch_len & 0xFF);
|
||||
//-- patch pcr PID --
|
||||
ofs = OFS_PMT_DATA;
|
||||
pkt[ofs] |= (vpid>>8);
|
||||
pkt[ofs+1] = (vpid & 0xFF);
|
||||
pkt[ofs] |= (pcrpid>>8);
|
||||
pkt[ofs+1] = (pcrpid & 0xFF);
|
||||
//-- write row with desc. for ES video stream --
|
||||
ofs = OFS_STREAM_TAB;
|
||||
pkt[ofs] = vtype;
|
||||
@@ -348,6 +352,7 @@ int CGenPsi::genpsi(int fd)
|
||||
|
||||
//-- finish --
|
||||
vpid=0;
|
||||
pcrpid=0;
|
||||
nba=0;
|
||||
nsub = 0;
|
||||
vtxtpid = 0;
|
||||
|
@@ -36,6 +36,7 @@ class CGenPsi
|
||||
short nba, nsub;
|
||||
uint16_t vpid;
|
||||
uint8_t vtype;
|
||||
uint16_t pcrpid;
|
||||
uint16_t vtxtpid;
|
||||
char vtxtlang[3];
|
||||
uint16_t apid[10];
|
||||
|
@@ -161,10 +161,14 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
|
||||
}
|
||||
|
||||
CGenPsi psi;
|
||||
if (allpids.PIDs.vpid != 0)
|
||||
psi.addPid(allpids.PIDs.vpid, recMovieInfo->VideoType ? EN_TYPE_AVC : EN_TYPE_VIDEO, 0);
|
||||
|
||||
numpids = 0;
|
||||
if (allpids.PIDs.vpid != 0){
|
||||
psi.addPid(allpids.PIDs.vpid, recMovieInfo->VideoType ? EN_TYPE_AVC : EN_TYPE_VIDEO, 0);
|
||||
if(allpids.PIDs.pcrpid != allpids.PIDs.vpid){
|
||||
psi.addPid(allpids.PIDs.pcrpid, EN_TYPE_PCR, 0);
|
||||
apids[numpids++]=allpids.PIDs.pcrpid;
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < recMovieInfo->audioPids.size(); i++) {
|
||||
apids[numpids++] = recMovieInfo->audioPids[i].epgAudioPid;
|
||||
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype);
|
||||
|
@@ -389,6 +389,11 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid)
|
||||
}
|
||||
}
|
||||
}
|
||||
//add pcr pid
|
||||
if(channel->getPcrPid() != channel->getVideoPid()){
|
||||
pids.insert(channel->getPcrPid());
|
||||
psi.addPid(channel->getPcrPid(), EN_TYPE_PCR, 0);
|
||||
}
|
||||
psi.genpsi(fd);
|
||||
|
||||
return !pids.empty();
|
||||
|
Reference in New Issue
Block a user