summaryrefslogtreecommitdiffstats
path: root/libhb/encx265.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/encx265.c
parentf122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff)
libhb: add hb_buffer_list
This brings together several independent implementations of a simple buffer list manager.
Diffstat (limited to 'libhb/encx265.c')
-rw-r--r--libhb/encx265.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/libhb/encx265.c b/libhb/encx265.c
index ad9f5ff86..d9c15637d 100644
--- a/libhb/encx265.c
+++ b/libhb/encx265.c
@@ -538,36 +538,20 @@ int encx265Work(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out
uint32_t nnal;
x265_nal *nal;
x265_picture pic_out;
- hb_buffer_t *last_buf = NULL;
+ hb_buffer_list_t list;
+
+ hb_buffer_list_clear(&list);
// flush delayed frames
while (x265_encoder_encode(pv->x265, &nal, &nnal, NULL, &pic_out) > 0)
{
hb_buffer_t *buf = nal_encode(w, &pic_out, nal, nnal);
- if (buf != NULL)
- {
- if (last_buf == NULL)
- {
- *buf_out = buf;
- }
- else
- {
- last_buf->next = buf;
- }
- last_buf = buf;
- }
+ hb_buffer_list_append(&list, buf);
}
-
// add the EOF to the end of the chain
- if (last_buf == NULL)
- {
- *buf_out = in;
- }
- else
- {
- last_buf->next = in;
- }
+ hb_buffer_list_append(&list, in);
+ *buf_out = hb_buffer_list_clear(&list);
*buf_in = NULL;
return HB_WORK_DONE;
}