diff options
-rw-r--r-- | libhb/decmpeg2.c | 4 | ||||
-rw-r--r-- | libhb/render.c | 4 | ||||
-rw-r--r-- | libhb/sync.c | 8 | ||||
-rw-r--r-- | libhb/work.c | 26 |
4 files changed, 34 insertions, 8 deletions
diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c index 03f6656b6..dd30ba8b5 100644 --- a/libhb/decmpeg2.c +++ b/libhb/decmpeg2.c @@ -389,6 +389,7 @@ int decmpeg2Work( hb_work_object_t * w, hb_buffer_t ** buf_in, { hb_work_private_t * pv = w->private_data; hb_buffer_t * buf, * last = NULL; + int status = HB_WORK_OK; // The reader found a chapter break, consume it completely, and remove it from the // stream. We need to shift it. @@ -405,6 +406,7 @@ int decmpeg2Work( hb_work_object_t * w, hb_buffer_t ** buf_in, { hb_list_add( pv->list, *buf_in ); *buf_in = NULL; + status = HB_WORK_DONE; } *buf_out = NULL; @@ -423,7 +425,7 @@ int decmpeg2Work( hb_work_object_t * w, hb_buffer_t ** buf_in, } } - return HB_WORK_OK; + return status; } /********************************************************************** diff --git a/libhb/render.c b/libhb/render.c index d12937e7a..ae326f63e 100644 --- a/libhb/render.c +++ b/libhb/render.c @@ -214,8 +214,8 @@ int renderWork( hb_work_object_t * w, hb_buffer_t ** buf_in, * to the next stage as well. Note that this will result in us * losing the current contents of the delay queue. */ - *buf_out = hb_buffer_init(0); - return HB_WORK_OK; + *buf_out = job->indepth_scan? NULL : hb_buffer_init(0); + return HB_WORK_DONE; } /* diff --git a/libhb/sync.c b/libhb/sync.c index 61e23ff00..efd1d17bf 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -289,6 +289,14 @@ static int SyncVideo( hb_work_object_t * w ) return HB_WORK_OK; } cur = pv->cur; + if( cur->size == 0 && pv->pts_offset == INT64_MIN ) + { + /* we got an end-of-stream with no video frames (happens during + * an indepth_scan). Feed the eos downstream & signal that we're done. */ + hb_fifo_push( job->fifo_sync, hb_buffer_init( 0 ) ); + pv->done = 1; + return HB_WORK_DONE; + } /* At this point we have a frame to process. Let's check 1) if we will be able to push into the fifo ahead diff --git a/libhb/work.c b/libhb/work.c index d2290ebf0..11a52bd02 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -103,7 +103,7 @@ static void do_job( hb_job_t * job, int cpu_count ) /* FIXME: This feels really hackish, anything better? */ hb_work_object_t * audio_w = NULL; hb_work_object_t * sub_w = NULL; - hb_work_object_t * encoder_w = NULL; + hb_work_object_t * final_w = NULL; hb_audio_t * audio; hb_subtitle_t * subtitle; @@ -247,6 +247,15 @@ static void do_job( hb_job_t * job, int cpu_count ) hb_list_add( job->list_work, ( w = getWork( WORK_RENDER ) ) ); w->fifo_in = job->fifo_sync; w->fifo_out = job->fifo_render; + if ( job->indepth_scan ) + { + /* + * if we're doing a subtitle scan the last thread in the + * processing pipeline is render - remember it so we can + * wait for its completion below. + */ + final_w = w; + } /* Video encoder */ switch( job->vcodec ) @@ -275,8 +284,15 @@ static void do_job( hb_job_t * job, int cpu_count ) w->config = &job->config; hb_list_add( job->list_work, w ); - /* remember the encoder so we can wait for it to finish */ - encoder_w = w; + if ( !job->indepth_scan ) + { + /* + * if we're not doing a subtitle scan the last thread in the + * processing pipeline is the encoder - remember it so we can + * wait for its completion below. + */ + final_w = w; + } if( job->select_subtitle && !job->indepth_scan ) { @@ -616,12 +632,12 @@ static void do_job( hb_job_t * job, int cpu_count ) w->init( w, job ); while( !*job->die ) { - if( w->work( w, NULL, NULL ) == HB_WORK_DONE ) + if( ( w->status = w->work( w, NULL, NULL ) ) == HB_WORK_DONE ) { done = 1; } if( done && - encoder_w->status == HB_WORK_DONE && + final_w->status == HB_WORK_DONE && !hb_fifo_size( job->fifo_mpeg4 ) ) { break; |