summaryrefslogtreecommitdiffstats
path: root/libhb/encavcodecaudio.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-08-25 09:49:36 -0700
committerJohn Stebbins <[email protected]>2015-09-24 13:01:44 -0700
commit2f912311718e522b2fb5e2a06446fe84a4247025 (patch)
tree3edc8e0bf2940bf455e42c0d697c60b5995995e2 /libhb/encavcodecaudio.c
parentf122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff)
libhb: add hb_buffer_list
This brings together several independent implementations of a simple buffer list manager.
Diffstat (limited to 'libhb/encavcodecaudio.c')
-rw-r--r--libhb/encavcodecaudio.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c
index 2f302b348..ed4997e1e 100644
--- a/libhb/encavcodecaudio.c
+++ b/libhb/encavcodecaudio.c
@@ -426,26 +426,19 @@ static hb_buffer_t* Encode(hb_work_object_t *w)
static hb_buffer_t * Flush( hb_work_object_t * w )
{
- hb_buffer_t *first, *buf, *last;
+ hb_buffer_list_t list;
+ hb_buffer_t *buf;
- first = last = buf = Encode( w );
- while( buf )
+ hb_buffer_list_clear(&list);
+ buf = Encode( w );
+ while (buf != NULL)
{
- last = buf;
- buf->next = Encode( w );
- buf = buf->next;
+ hb_buffer_list_append(&list, buf);
+ buf = Encode( w );
}
- if( last )
- {
- last->next = hb_buffer_eof_init();
- }
- else
- {
- first = hb_buffer_eof_init();
- }
-
- return first;
+ hb_buffer_list_append(&list, hb_buffer_eof_init());
+ return hb_buffer_list_clear(&list);
}
/***********************************************************************
@@ -458,6 +451,7 @@ static int encavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
{
hb_work_private_t * pv = w->private_data;
hb_buffer_t * in = *buf_in, * buf;
+ hb_buffer_list_t list;
if (in->s.flags & HB_BUF_FLAG_EOF)
{
@@ -475,14 +469,15 @@ static int encavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_list_add( pv->list, in );
*buf_in = NULL;
- *buf_out = buf = Encode( w );
-
- while ( buf )
+ hb_buffer_list_clear(&list);
+ buf = Encode( w );
+ while (buf != NULL)
{
- buf->next = Encode( w );
- buf = buf->next;
+ hb_buffer_list_append(&list, buf);
+ buf = Encode( w );
}
+ *buf_out = hb_buffer_list_clear(&list);
return HB_WORK_OK;
}