]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsmsg now only have 'signed 64 bit' as internal type.
authorAndreas Öman <andreas@lonelycoder.com>
Sat, 4 Oct 2008 10:21:39 +0000 (10:21 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sat, 4 Oct 2008 10:21:39 +0000 (10:21 +0000)
We allow conversion to/from u32 and s32 assuming it does not overflow.
This approach is more stringent and less error-prone.

htsp.c
webui/extjs.c

diff --git a/htsp.c b/htsp.c
index 4beddd0514a29a3b1cd2dff489071510e3aaa808..85d1ca39912110860be4f879002440da7ef56892 100644 (file)
--- a/htsp.c
+++ b/htsp.c
@@ -836,7 +836,7 @@ htsp_stream_deliver(void *opaque, struct th_pktref *pr)
   htsmsg_t *m = htsmsg_create(), *n;
   htsp_msg_t *hm;
   htsp_connection_t *htsp = hs->hs_htsp;
-  uint64_t ts;
+  int64_t ts;
   int qlen = hs->hs_q.hmq_payload;
 
   if((qlen > 500000 && pkt->pkt_frametype == PKT_B_FRAME) ||
@@ -855,9 +855,9 @@ htsp_stream_deliver(void *opaque, struct th_pktref *pr)
   htsmsg_add_u32(m, "channelId", hs->hs_channelid);
   htsmsg_add_u32(m, "frametype", frametypearray[pkt->pkt_frametype]);
 
-  htsmsg_add_u64(m, "stream", pkt->pkt_componentindex);
-  htsmsg_add_u64(m, "dts", pkt->pkt_dts);
-  htsmsg_add_u64(m, "pts", pkt->pkt_pts);
+  htsmsg_add_u32(m, "stream", pkt->pkt_componentindex);
+  htsmsg_add_s64(m, "dts", pkt->pkt_dts);
+  htsmsg_add_s64(m, "pts", pkt->pkt_pts);
   htsmsg_add_u32(m, "duration", pkt->pkt_duration);
   htsmsg_add_u32(m, "com", pkt->pkt_commercial);
   
@@ -886,11 +886,11 @@ htsp_stream_deliver(void *opaque, struct th_pktref *pr)
     pthread_mutex_lock(&htsp->htsp_out_mutex);
 
     if(TAILQ_FIRST(&hs->hs_q.hmq_q) == NULL) {
-      htsmsg_add_u64(m, "delay", 0);
+      htsmsg_add_s64(m, "delay", 0);
     } else if((hm = TAILQ_FIRST(&hs->hs_q.hmq_q)) != NULL &&
-             (n = hm->hm_msg) != NULL && !htsmsg_get_u64(n, "dts", &ts) &&
+             (n = hm->hm_msg) != NULL && !htsmsg_get_s64(n, "dts", &ts) &&
              pkt->pkt_dts != AV_NOPTS_VALUE && ts != AV_NOPTS_VALUE) {
-      htsmsg_add_u64(m, "delay", pkt->pkt_dts - ts);
+      htsmsg_add_s64(m, "delay", pkt->pkt_dts - ts);
     }
     pthread_mutex_unlock(&htsp->htsp_out_mutex);
 
index 57c9213a47b1084a2a8482e207a71fed455804f9..01958bd5456e4701836e0e288537dbd396307ff3 100644 (file)
@@ -1171,7 +1171,7 @@ extjs_dvrlist(http_connection_t *hc, const char *remain, void *opaque)
       fsize = dvr_get_filesize(de);
       if(fsize > 0) {
        char url[100];
-       htsmsg_add_u64(m, "filesize", fsize);
+       htsmsg_add_s64(m, "filesize", fsize);
 
        snprintf(url, sizeof(url), "/dvrfile/%d", de->de_id);
        htsmsg_add_str(m, "url", url);