Add some helpers
This commit is contained in:
parent
1ac3d9d65d
commit
b7cc8e2961
2 changed files with 30 additions and 0 deletions
24
src/packet.c
24
src/packet.c
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue