Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts pid: add mpegts_pid_dump(), fix mpegts_pid_init()
  • Loading branch information
perexg committed Mar 11, 2015
1 parent 2dfc271 commit af7e0a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/input/mpegts.h
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions src/input/mpegts/mpegts_pid.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
9 changes: 4 additions & 5 deletions src/satip/rtsp.c
Expand Up @@ -828,15 +828,14 @@ rtsp_process_play(http_connection_t *hc, int setup)
}

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);
Expand Down

0 comments on commit af7e0a3

Please sign in to comment.