diff options
author | John Stebbins <[email protected]> | 2015-08-25 09:49:36 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-09-24 13:01:44 -0700 |
commit | 2f912311718e522b2fb5e2a06446fe84a4247025 (patch) | |
tree | 3edc8e0bf2940bf455e42c0d697c60b5995995e2 /libhb/encx264.c | |
parent | f122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff) |
libhb: add hb_buffer_list
This brings together several independent implementations of a simple
buffer list manager.
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r-- | libhb/encx264.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index 24e838357..2580f2ee9 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -53,8 +53,6 @@ struct hb_work_private_s x264_picture_t pic_in; uint8_t * grey_data; - uint32_t frames_in; - uint32_t frames_out; int64_t last_stop; // Debugging - stop time of previous input frame hb_list_t *delayed_chapters; @@ -669,8 +667,11 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, x264_picture_t pic_out; int i_nal; x264_nal_t *nal; - hb_buffer_t *last_buf = NULL; + hb_buffer_list_t list; + hb_buffer_list_clear(&list); + + // flush delayed frames while ( x264_encoder_delayed_frames( pv->x264 ) ) { x264_encoder_encode( pv->x264, &nal, &i_nal, NULL, &pic_out ); @@ -680,29 +681,17 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, break; hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal ); - if ( buf ) - { - ++pv->frames_out; - if ( last_buf == NULL ) - *buf_out = buf; - else - last_buf->next = buf; - last_buf = buf; - } + hb_buffer_list_append(&list, buf); } - // Flushed everything - add the eof to the end of the chain. - if ( last_buf == NULL ) - *buf_out = in; - else - last_buf->next = in; + // add the EOF to the end of the chain + hb_buffer_list_append(&list, in); + *buf_out = hb_buffer_list_clear(&list); *buf_in = NULL; return HB_WORK_DONE; } // Not EOF - encode the packet & wrap it in a NAL - ++pv->frames_in; - ++pv->frames_out; *buf_out = x264_encode( w, in ); return HB_WORK_OK; } |