comparison libdirac_libschro.c @ 7233:238a3511f183 libavcodec

Add a parameter for queue size. Patch by Anuradha Suraparaju anuradha rd bbc co uk
author benoit
date Thu, 10 Jul 2008 11:40:19 +0000
parents 33627a932270
children e9d9d946f213
comparison
equal deleted inserted replaced
7232:cc55dd004819 7233:238a3511f183
68 } 68 }
69 69
70 void ff_dirac_schro_queue_init (FfmpegDiracSchroQueue *queue) 70 void ff_dirac_schro_queue_init (FfmpegDiracSchroQueue *queue)
71 { 71 {
72 queue->p_head = queue->p_tail = NULL; 72 queue->p_head = queue->p_tail = NULL;
73 queue->size = 0;
73 } 74 }
74 75
75 void ff_dirac_schro_queue_free (FfmpegDiracSchroQueue *queue, 76 void ff_dirac_schro_queue_free (FfmpegDiracSchroQueue *queue,
76 void (*free_func)(void *)) 77 void (*free_func)(void *))
77 { 78 {
94 queue->p_head = p_new; 95 queue->p_head = p_new;
95 else 96 else
96 queue->p_tail->next = p_new; 97 queue->p_tail->next = p_new;
97 queue->p_tail = p_new; 98 queue->p_tail = p_new;
98 99
100 ++queue->size;
99 return 0; 101 return 0;
100 } 102 }
101 103
102 void *ff_dirac_schro_queue_pop (FfmpegDiracSchroQueue *queue) 104 void *ff_dirac_schro_queue_pop (FfmpegDiracSchroQueue *queue)
103 { 105 {
104 FfmpegDiracSchroQueueElement *top = queue->p_head; 106 FfmpegDiracSchroQueueElement *top = queue->p_head;
105 107
106 if (top != NULL) { 108 if (top != NULL) {
107 void *data = top->data; 109 void *data = top->data;
108 queue->p_head = queue->p_head->next; 110 queue->p_head = queue->p_head->next;
111 --queue->size;
109 av_freep (&top); 112 av_freep (&top);
110 return data; 113 return data;
111 } 114 }
112 115
113 return NULL; 116 return NULL;