]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add some helpers
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 26 Oct 2010 19:08:38 +0000 (19:08 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 26 Oct 2010 19:08:38 +0000 (19:08 +0000)
src/packet.c
src/packet.h

index 972c4526ce1642dd6b44b83e42a6942a1b46f419..c3efdb0f2b96e84bd1384125ac5a71aa79479f77 100644 (file)
@@ -101,6 +101,30 @@ pktref_clear_queue(struct th_pktref_queue *q)
 }
 
 
+/**
+ * Reference count is transfered to queue
+ */
+void
+pktref_enqueue(struct th_pktref_queue *q, th_pkt_t *pkt)
+{
+  th_pktref_t *pr = malloc(sizeof(th_pktref_t));
+  pr->pr_pkt = pkt;
+  TAILQ_INSERT_TAIL(q, pr, pr_link);
+}
+
+
+/**
+ *
+ */
+void
+pktref_remove(struct th_pktref_queue *q, th_pktref_t *pr)
+{
+  TAILQ_REMOVE(q, pr, pr_link);
+  pkt_ref_dec(pr->pr_pkt);
+  free(pr);
+}
+
+
 /**
  *
  */
index 0ed40ad59d749ff279be0d34391a9f6c31e92bab..836c2d55116b04725dac520d9a8d46388190d93a 100644 (file)
@@ -79,6 +79,12 @@ void pkt_ref_inc_poly(th_pkt_t *pkt, int n);
 
 void pktref_clear_queue(struct th_pktref_queue *q);
 
+// Reference count is transfered to queue
+void pktref_enqueue(struct th_pktref_queue *q, th_pkt_t *pkt);
+
+void pktref_remove(struct th_pktref_queue *q, th_pktref_t *pr);
+
+
 th_pkt_t *pkt_alloc(const void *data, size_t datalen, int64_t pts, int64_t dts);
 
 th_pkt_t *pkt_merge_header(th_pkt_t *pkt);