increment the pmt version on eatch reconfiguration of the passthrough muxer

This commit is contained in:
John Törnblom 2012-12-01 12:50:00 +01:00
parent d65a8610ab
commit d8d7a2f583
3 changed files with 12 additions and 5 deletions

View file

@ -51,6 +51,7 @@ typedef struct pass_muxer {
/* TS muxing */
uint8_t *pm_pat;
uint8_t *pm_pmt;
uint16_t pm_pmt_version;
uint32_t pm_ic; // Injection counter
uint32_t pm_pc; // Packet counter
} pass_muxer_t;
@ -128,11 +129,13 @@ pass_muxer_reconfigure(muxer_t* m, const struct streaming_start *ss)
pm->pm_pmt[2] = 0x00 | (ss->ss_pmt_pid >> 0);
pm->pm_pmt[3] = 0x10;
pm->pm_pmt[4] = 0x00;
if(psi_build_pmt(ss, pm->pm_pmt+5, 183, ss->ss_pcr_pid) < 0) {
if(psi_build_pmt(ss, pm->pm_pmt+5, 183, pm->pm_pmt_version,
ss->ss_pcr_pid) < 0) {
pm->m_errors++;
tvhlog(LOG_ERR, "pass", "%s: Unable to build pmt", pm->pm_filename);
return -1;
}
pm->pm_pmt_version++;
}
return 0;

View file

@ -710,7 +710,8 @@ psi_parse_pmt(service_t *t, const uint8_t *ptr, int len, int chksvcid,
* PMT generator
*/
int
psi_build_pmt(const streaming_start_t *ss, uint8_t *buf0, int maxlen, int pcrpid)
psi_build_pmt(const streaming_start_t *ss, uint8_t *buf0, int maxlen,
int version, int pcrpid)
{
int c, tlen, dlen, l, i;
uint8_t *buf, *buf1;
@ -726,8 +727,10 @@ psi_build_pmt(const streaming_start_t *ss, uint8_t *buf0, int maxlen, int pcrpid
buf[4] = 0x01;
buf[5] = 0xc1; /* current_next_indicator + version */
buf[6] = 0;
buf[7] = 0;
buf[5] |= (version & 0x1F) << 1;
buf[6] = 0; /* section number */
buf[7] = 0; /* last section number */
buf[8] = 0xe0 | (pcrpid >> 8);
buf[9] = pcrpid;

View file

@ -45,7 +45,8 @@ int psi_parse_pmt(struct service *t, const uint8_t *ptr, int len, int chksvcid,
int psi_build_pat(struct service *t, uint8_t *buf, int maxlen, int pmtpid);
int psi_build_pmt(const streaming_start_t *ss, uint8_t *buf, int maxlen, int pcrpid);
int psi_build_pmt(const streaming_start_t *ss, uint8_t *buf, int maxlen,
int version, int pcrpid);
const char *psi_caid2name(uint16_t caid);