]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts pid: add mpegts_pid_dump(), fix mpegts_pid_init()
authorJaroslav Kysela <perex@perex.cz>
Mon, 9 Mar 2015 16:52:28 +0000 (17:52 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:13 +0000 (21:41 +0100)
src/input/mpegts.h
src/input/mpegts/mpegts_pid.c
src/satip/rtsp.c

index c6e9325e41210ca3a0f228ddc2673d98c6bdd9fa..136d773cf6d7f04d58d472c5e9055ba697bf7484 100644 (file)
@@ -99,6 +99,7 @@ static inline int mpegts_pid_exists ( mpegts_apids_t *pids, mpegts_apid_t pid )
 int mpegts_pid_copy ( mpegts_apids_t *dst, mpegts_apids_t *src );
 int mpegts_pid_compare ( mpegts_apids_t *dst, mpegts_apids_t *src,
                          mpegts_apids_t *add, mpegts_apids_t *del );
+int mpegts_pid_dump ( mpegts_apids_t *pids, char *buf, int len );
 
 /* **************************************************************************
  * Data / SI processing
index 1d645173398884ed03bfe1fb92a78c1091b88dc1..8bbea6034515f814e2948f936215743aa23a133b 100644 (file)
@@ -29,6 +29,7 @@ mpegts_pid_init(mpegts_apids_t *pids, mpegts_apid_t *vals, int count)
     return -1;
   pids->pids = p;
   pids->alloc = alloc;
+  pids->count = 0;
   pids->all = 0;
   if (vals) {
     memcpy(p, vals, count * sizeof(*pids));
@@ -177,3 +178,16 @@ mpegts_pid_compare(mpegts_apids_t *dst, mpegts_apids_t *src,
       mpegts_pid_add(add, dst->pids[i]);
   return add->count || del->count;
 }
+
+int
+mpegts_pid_dump(mpegts_apids_t *pids, char *buf, int len)
+{
+  int i, l = 0;
+
+  if (pids->all)
+    return snprintf(buf, len, "all");
+  for (i = 0; i < pids->count; i++)
+    l += snprintf(buf + l, len - l, "%s%i",
+                  i > 0 ? "," : "", pids->pids[i]);
+  return l;
+}
index c41fa4e4fbd42503c4827a286c8c671ddc6478bd..a6b821733edad21a6c917e8118c8b2c8b6f92037 100644 (file)
@@ -828,15 +828,14 @@ play:
   }
 
   if (setup)
-    tvhdebug("satips", "setup from %s:%d, RTP: %d, RTCP: %d",
+    tvhdebug("satips", "setup from %s:%d, RTP: %d, RTCP: %d, pids ",
              addrbuf, IP_PORT(*hc->hc_peer),
              rs->rtp_peer_port, rs->rtp_peer_port + 1);
+
   dvb_mux_conf_str(dmc, buf, sizeof(buf));
   s = buf + strlen(buf);
-  for (r = 0; r < rs->pids.count; r++) {
-    s += snprintf(s, sizeof(buf) - (s - buf), "%s%i",
-                  r > 0 ? "," : " pids ", rs->pids.pids[r]);
-  }
+  mpegts_pid_dump(&rs->pids, s, sizeof(buf) - (s - buf));
+
   tvhdebug("satips", "%i/%s/%d: %s %s",
            rs->frontend, rs->session, rs->stream,
            setup ? "setup" : "play", buf);