]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
increment the pmt version on eatch reconfiguration of the passthrough muxer
authorJohn Törnblom <john.tornblom@gmail.com>
Sat, 1 Dec 2012 11:50:00 +0000 (12:50 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Wed, 5 Dec 2012 18:26:05 +0000 (19:26 +0100)
src/muxer_pass.c
src/psi.c
src/psi.h

index f6658ad5d56de8331124d77a31840eb988a6f314..933be24b53d3d3bf266e869a751d15441b6e6e37 100644 (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;
index ff298fad16536ab0d147a602205c57bb840870dc..4d49ca718de6ad9ffa7a4136aff182c0d4c433e6 100644 (file)
--- a/src/psi.c
+++ b/src/psi.c
@@ -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;
index 270c43352db8c93fde830b97dd692d3a0778dae3..a3b099cfb3e6acc439a5133efbf1762767ab9625 100644 (file)
--- a/src/psi.h
+++ b/src/psi.h
@@ -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);