summaryrefslogtreecommitdiffstats
path: root/libhb/declpcm.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/declpcm.c
parentf122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff)
libhb: add hb_buffer_list
This brings together several independent implementations of a simple buffer list manager.
Diffstat (limited to 'libhb/declpcm.c')
-rw-r--r--libhb/declpcm.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libhb/declpcm.c b/libhb/declpcm.c
index c85c803e9..c7aa5343c 100644
--- a/libhb/declpcm.c
+++ b/libhb/declpcm.c
@@ -188,7 +188,9 @@ static int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_work_private_t * pv = w->private_data;
hb_buffer_t *in = *buf_in;
hb_buffer_t *buf = NULL;
+ hb_buffer_list_t list;
+ hb_buffer_list_clear(&list);
if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
@@ -199,13 +201,14 @@ static int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
pv->sequence = in->sequence;
- /* if we have a frame to finish, add enough data from this buf to finish it */
- if ( pv->size )
+ // if we have a frame to finish, add enough data from this buf
+ // to finish it
+ if (pv->size)
{
- memcpy( pv->frame + pv->pos, in->data + 6, pv->size - pv->pos );
+ memcpy(pv->frame + pv->pos, in->data + 6, pv->size - pv->pos);
buf = Decode( w );
+ hb_buffer_list_append(&list, buf);
}
- *buf_out = buf;
/* save the (rest of) data from this buf in our frame buffer */
lpcmInfo( w, in );
@@ -213,18 +216,14 @@ static int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
int amt = in->size - off;
pv->pos = amt;
memcpy( pv->frame, in->data + off, amt );
- if ( amt >= pv->size )
+ if (amt >= pv->size)
{
- if ( buf )
- {
- buf->next = Decode( w );
- }
- else
- {
- *buf_out = Decode( w );
- }
+ buf = Decode( w );
+ hb_buffer_list_append(&list, buf);
pv->size = 0;
}
+
+ *buf_out = hb_buffer_list_clear(&list);
return HB_WORK_OK;
}