diff options
author | John Stebbins <[email protected]> | 2015-11-15 15:52:58 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-11-15 15:52:58 -0800 |
commit | fb871fd8b3b5716f1fc00c9aeacba335a652a526 (patch) | |
tree | bfd52bf3d8e869a1eb4de6463dc880be4bea8e9b /libhb | |
parent | 6ac2175e77baf2dca4803ea7a4792806697ac2b0 (diff) |
decsrt: configure as buffer source
set fifo_in to NULL so hb_work_loop will call repeadedly without the
hack that primes it's input fifo.
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/decsrtsub.c | 21 | ||||
-rw-r--r-- | libhb/work.c | 9 |
2 files changed, 11 insertions, 19 deletions
diff --git a/libhb/decsrtsub.c b/libhb/decsrtsub.c index 164f7c09f..98c36cf64 100644 --- a/libhb/decsrtsub.c +++ b/libhb/decsrtsub.c @@ -600,7 +600,6 @@ static int decsrtInit( hb_work_object_t * w, hb_job_t * job ) { int retval = 1; hb_work_private_t * pv; - hb_buffer_t *buffer; int i; hb_chapter_t * chapter; @@ -610,10 +609,6 @@ static int decsrtInit( hb_work_object_t * w, hb_job_t * job ) w->private_data = pv; pv->job = job; - - buffer = hb_buffer_init( 0 ); - hb_fifo_push( w->fifo_in, buffer); - pv->current_state = k_state_potential_new_entry; pv->number_of_entries = 0; pv->last_entry_number = 0; @@ -688,26 +683,18 @@ static int decsrtWork( 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 * out = NULL; out = srt_read( pv ); - if( out ) + if (out != NULL) { hb_srt_to_ssa(out, ++pv->line); - - /* - * Keep a buffer in our input fifo so that we get run. - */ - hb_fifo_push( w->fifo_in, in); - *buf_in = NULL; *buf_out = out; - } else { - *buf_out = NULL; return HB_WORK_OK; + } else { + *buf_out = hb_buffer_eof_init(); + return HB_WORK_DONE; } - - return HB_WORK_OK; } static void decsrtClose( hb_work_object_t * w ) diff --git a/libhb/work.c b/libhb/work.c index 931512999..7de0c0247 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -1531,6 +1531,7 @@ static void do_job(hb_job_t *job) for (i = 0; i < hb_list_count( job->list_subtitle ); i++) { subtitle = hb_list_item( job->list_subtitle, i ); + w = hb_get_work( job->h, subtitle->codec ); // Must set capacity of the raw-FIFO to be set >= the maximum // number of subtitle lines that could be decoded prior to a // video frame in order to prevent the following deadlock @@ -1546,11 +1547,15 @@ static void do_job(hb_job_t *job) // Since that number is unbounded, the FIFO must be made // (effectively) unbounded in capacity. subtitle->fifo_raw = hb_fifo_init( FIFO_UNBOUNDED, FIFO_UNBOUNDED_WAKE ); - subtitle->fifo_in = hb_fifo_init( FIFO_SMALL, FIFO_SMALL_WAKE ); + if (w->id != WORK_DECSRTSUB) + { + // decsrtsub is a buffer source like reader. It's input comes + // from a file. + subtitle->fifo_in = hb_fifo_init( FIFO_SMALL, FIFO_SMALL_WAKE ); + } subtitle->fifo_sync = hb_fifo_init( FIFO_SMALL, FIFO_SMALL_WAKE ); subtitle->fifo_out = hb_fifo_init( FIFO_SMALL, FIFO_SMALL_WAKE ); - w = hb_get_work( job->h, subtitle->codec ); w->fifo_in = subtitle->fifo_in; w->fifo_out = subtitle->fifo_raw; w->subtitle = subtitle; |