rendered paste bodyIndex: libhb/reader.c===================================================================--- libhb/reader.c (revision 1409)+++ libhb/reader.c (working copy)@@ -269,6 +269,9 @@ } } + /* send an empty buffer upstream to signal we're done */+ hb_fifo_push( r->job->fifo_mpeg2, hb_buffer_init(0) );+ hb_list_empty( &list ); hb_buffer_close( &r->ps ); if (r->dvd)Index: libhb/decmpeg2.c===================================================================--- libhb/decmpeg2.c (revision 1409)+++ libhb/decmpeg2.c (working copy)@@ -77,14 +77,17 @@ hb_buffer_t * buf; uint8_t * data; - /* Feed libmpeg2 */- if( buf_es->start > -1 )+ if ( buf_es->size ) {- mpeg2_tag_picture( m->libmpeg2, buf_es->start >> 32,- buf_es->start & 0xFFFFFFFF );+ /* Feed libmpeg2 */+ if( buf_es->start > -1 )+ {+ mpeg2_tag_picture( m->libmpeg2, buf_es->start >> 32,+ buf_es->start & 0xFFFFFFFF );+ }+ mpeg2_buffer( m->libmpeg2, buf_es->data,+ buf_es->data + buf_es->size ); }- mpeg2_buffer( m->libmpeg2, buf_es->data,- buf_es->data + buf_es->size ); for( ;; ) {@@ -397,6 +400,13 @@ hb_libmpeg2_decode( pv->libmpeg2, *buf_in, pv->list ); + /* if we got an empty buffer signaling end-of-stream send it downstream */+ if ( (*buf_in)->size == 0 )+ {+ hb_list_add( pv->list, *buf_in );+ *buf_in = NULL;+ }+ *buf_out = NULL; while( ( buf = hb_list_item( pv->list, 0 ) ) ) {Index: libhb/sync.c===================================================================--- libhb/sync.c (revision 1409)+++ libhb/sync.c (working copy)@@ -284,22 +284,6 @@ return HB_WORK_DONE; } - if( hb_thread_has_exited( job->reader ) &&- !hb_fifo_size( job->fifo_mpeg2 ) &&- !hb_fifo_size( job->fifo_raw ) )- {- pv->done = 1;-- hb_buffer_t * buf_tmp;-- // Drop an empty buffer into our output to ensure that things- // get flushed all the way out.- buf_tmp = hb_buffer_init(0); // Empty end buffer- hb_fifo_push( job->fifo_sync, buf_tmp );-- return HB_WORK_DONE;- }- if( !pv->cur && !( pv->cur = hb_fifo_get( job->fifo_raw ) ) ) { /* We haven't even got a frame yet */@@ -316,6 +300,21 @@ { hb_buffer_t * buf_tmp; + if( next->size == 0 )+ {+ // we got the empty buffer that signals end-of-stream+ pv->done = 1;++ hb_buffer_t * buf_tmp = hb_fifo_get( job->fifo_raw );+ hb_buffer_close( &buf_tmp );++ // Drop an empty buffer into our output to ensure that things+ // get flushed all the way out.+ hb_fifo_push( job->fifo_sync, hb_buffer_init( 0 ) );++ return HB_WORK_DONE;+ }+ if( pv->pts_offset == INT64_MIN ) { /* This is our first frame */