summaryrefslogtreecommitdiffstats
path: root/libhb/enclame.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/enclame.c
parentf122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff)
libhb: add hb_buffer_list
This brings together several independent implementations of a simple buffer list manager.
Diffstat (limited to 'libhb/enclame.c')
-rw-r--r--libhb/enclame.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/libhb/enclame.c b/libhb/enclame.c
index 0efe21906..9ba7c5d87 100644
--- a/libhb/enclame.c
+++ b/libhb/enclame.c
@@ -185,7 +185,10 @@ int enclameWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_audio_t * audio = w->audio;
hb_buffer_t * in = *buf_in;
hb_buffer_t * buf;
+ hb_buffer_list_t list;
+ *buf_in = NULL;
+ hb_buffer_list_clear(&list);
if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input - send it downstream & say we're done */
@@ -202,35 +205,24 @@ int enclameWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
{
hb_buffer_close( &buf );
}
-
- // Add the flushed data
- *buf_out = buf;
-
+ hb_buffer_list_append(&list, buf);
// Add the eof
- if ( buf )
- {
- buf->next = in;
- }
- else
- {
- *buf_out = in;
- }
+ hb_buffer_list_append(&list, in);
- *buf_in = NULL;
+ *buf_out = hb_buffer_list_clear(&list);
return HB_WORK_DONE;
}
- hb_list_add( pv->list, *buf_in );
- *buf_in = NULL;
-
- *buf_out = buf = Encode( w );
+ hb_list_add(pv->list, in);
- while( buf )
+ buf = Encode( w );
+ while (buf)
{
- 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;
}