summaryrefslogtreecommitdiffstats
path: root/libhb/platform/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-02-24 19:15:12 +0100
committerDamiano Galassi <[email protected]>2017-02-24 19:23:03 +0100
commitb2ca0b4f50c2cdea14dcb98f050265377c49b569 (patch)
tree3838dfb1621ffb689e109e1112c5a435f2f7f743 /libhb/platform/macosx
parent425242e573298086b7d66809318341b39bfeb008 (diff)
encca_aac: use the libhb list helper functions to append buffers
Diffstat (limited to 'libhb/platform/macosx')
-rw-r--r--libhb/platform/macosx/encca_aac.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c
index a3d8fd860..c60048945 100644
--- a/libhb/platform/macosx/encca_aac.c
+++ b/libhb/platform/macosx/encca_aac.c
@@ -481,32 +481,14 @@ static hb_buffer_t* Encode(hb_work_object_t *w)
return obuf;
}
-static hb_buffer_t* Flush(hb_work_object_t *w, hb_buffer_t *bufin)
+static void Flush(hb_work_object_t *w, hb_buffer_list_t * list)
{
- hb_buffer_t *bufout = NULL, *buf = NULL, *b = NULL;
- while ((b = Encode(w)))
+ hb_buffer_t *buf = Encode(w);
+ while (buf)
{
- if (bufout == NULL)
- {
- bufout = b;
- }
- else
- {
- buf->next = b;
- }
- buf = b;
- }
-
- // add the eof marker to the end of our buf chain
- if (buf != NULL)
- {
- buf->next = bufin;
+ hb_buffer_list_append(list, buf);
+ buf = Encode(w);
}
- else
- {
- bufout = bufin;
- }
- return bufout;
}
/***********************************************************************
@@ -518,16 +500,18 @@ int encCoreAudioWork(hb_work_object_t *w, hb_buffer_t **buf_in,
hb_buffer_t **buf_out)
{
hb_work_private_t *pv = w->private_data;
- hb_buffer_t * in = *buf_in;
- hb_buffer_t *buf;
+ 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. Finish encoding what we have buffered then send
- // it & the eof downstream.
+ /* EOF on input - send it downstream & say we're done */
pv->input_done = 1;
- *buf_out = Flush(w, in);
+ Flush(w, &list);
+ hb_buffer_list_append(&list, hb_buffer_eof_init());
+ *buf_out = hb_buffer_list_clear(&list);
return HB_WORK_DONE;
}
@@ -535,15 +519,17 @@ int encCoreAudioWork(hb_work_object_t *w, hb_buffer_t **buf_in,
{
pv->first_pts = in->s.start;
}
- hb_list_add(pv->list, in);
- *buf_out = buf = Encode(w);
+ hb_list_add(pv->list, in);
+ *buf_in = NULL;
- while (buf != NULL)
+ 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;
}