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;
|
vpid = 0;
|
||||||
vtype = 0;
|
vtype = 0;
|
||||||
|
|
||||||
|
pcrpid=0;
|
||||||
vtxtpid = 0;
|
vtxtpid = 0;
|
||||||
vtxtlang[0] = 'g';
|
vtxtlang[0] = 'g';
|
||||||
vtxtlang[1] = 'e';
|
vtxtlang[1] = 'e';
|
||||||
@@ -160,9 +161,12 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *da
|
|||||||
switch(pidtype)
|
switch(pidtype)
|
||||||
{
|
{
|
||||||
case EN_TYPE_VIDEO:
|
case EN_TYPE_VIDEO:
|
||||||
vpid=pid;
|
pcrpid=vpid=pid;
|
||||||
vtype = ES_TYPE_MPEG12;
|
vtype = ES_TYPE_MPEG12;
|
||||||
break;
|
break;
|
||||||
|
case EN_TYPE_PCR:
|
||||||
|
pcrpid=pid;
|
||||||
|
break;
|
||||||
case EN_TYPE_AVC:
|
case EN_TYPE_AVC:
|
||||||
vpid=pid;
|
vpid=pid;
|
||||||
vtype = ES_TYPE_AVC;
|
vtype = ES_TYPE_AVC;
|
||||||
@@ -243,9 +247,9 @@ int CGenPsi::genpsi(int fd)
|
|||||||
}
|
}
|
||||||
//-- write row with desc. for pcr stream (eq. video) --
|
//-- write row with desc. for pcr stream (eq. video) --
|
||||||
pkt[ofs] = EN_TYPE_PCR;
|
pkt[ofs] = EN_TYPE_PCR;
|
||||||
pkt[ofs+1] = 0x02;
|
pkt[ofs+1] = 0x02;//vtype ???
|
||||||
pkt[ofs+2] = (vpid>>8);
|
pkt[ofs+2] = (pcrpid>>8);
|
||||||
pkt[ofs+3] = (vpid & 0xFF);
|
pkt[ofs+3] = (pcrpid & 0xFF);
|
||||||
|
|
||||||
//-- calculate CRC --
|
//-- calculate CRC --
|
||||||
calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 );
|
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);
|
pkt[OFS_HDR_2+2] = (patch_len & 0xFF);
|
||||||
//-- patch pcr PID --
|
//-- patch pcr PID --
|
||||||
ofs = OFS_PMT_DATA;
|
ofs = OFS_PMT_DATA;
|
||||||
pkt[ofs] |= (vpid>>8);
|
pkt[ofs] |= (pcrpid>>8);
|
||||||
pkt[ofs+1] = (vpid & 0xFF);
|
pkt[ofs+1] = (pcrpid & 0xFF);
|
||||||
//-- write row with desc. for ES video stream --
|
//-- write row with desc. for ES video stream --
|
||||||
ofs = OFS_STREAM_TAB;
|
ofs = OFS_STREAM_TAB;
|
||||||
pkt[ofs] = vtype;
|
pkt[ofs] = vtype;
|
||||||
@@ -348,6 +352,7 @@ int CGenPsi::genpsi(int fd)
|
|||||||
|
|
||||||
//-- finish --
|
//-- finish --
|
||||||
vpid=0;
|
vpid=0;
|
||||||
|
pcrpid=0;
|
||||||
nba=0;
|
nba=0;
|
||||||
nsub = 0;
|
nsub = 0;
|
||||||
vtxtpid = 0;
|
vtxtpid = 0;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#define EN_TYPE_AUDIO 0x01
|
#define EN_TYPE_AUDIO 0x01
|
||||||
#define EN_TYPE_TELTEX 0x02
|
#define EN_TYPE_TELTEX 0x02
|
||||||
#define EN_TYPE_PCR 0x03
|
#define EN_TYPE_PCR 0x03
|
||||||
#define EN_TYPE_AVC 0x04
|
#define EN_TYPE_AVC 0x04
|
||||||
#define EN_TYPE_DVBSUB 0x06
|
#define EN_TYPE_DVBSUB 0x06
|
||||||
|
|
||||||
class CGenPsi
|
class CGenPsi
|
||||||
@@ -36,6 +36,7 @@ class CGenPsi
|
|||||||
short nba, nsub;
|
short nba, nsub;
|
||||||
uint16_t vpid;
|
uint16_t vpid;
|
||||||
uint8_t vtype;
|
uint8_t vtype;
|
||||||
|
uint16_t pcrpid;
|
||||||
uint16_t vtxtpid;
|
uint16_t vtxtpid;
|
||||||
char vtxtlang[3];
|
char vtxtlang[3];
|
||||||
uint16_t apid[10];
|
uint16_t apid[10];
|
||||||
|
@@ -161,10 +161,14 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGenPsi psi;
|
CGenPsi psi;
|
||||||
if (allpids.PIDs.vpid != 0)
|
|
||||||
psi.addPid(allpids.PIDs.vpid, recMovieInfo->VideoType ? EN_TYPE_AVC : EN_TYPE_VIDEO, 0);
|
|
||||||
|
|
||||||
numpids = 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++) {
|
for (unsigned int i = 0; i < recMovieInfo->audioPids.size(); i++) {
|
||||||
apids[numpids++] = recMovieInfo->audioPids[i].epgAudioPid;
|
apids[numpids++] = recMovieInfo->audioPids[i].epgAudioPid;
|
||||||
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype);
|
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);
|
psi.genpsi(fd);
|
||||||
|
|
||||||
return !pids.empty();
|
return !pids.empty();
|
||||||
|
Reference in New Issue
Block a user