diff options
author | eddyg <[email protected]> | 2009-05-06 02:25:58 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2009-05-06 02:25:58 +0000 |
commit | 6add7d899f49abbe2b6cc0702296941e948f5ef5 (patch) | |
tree | 386ec27521bf5b11a54065869dd8b0ea3220ad76 /libhb/sync.c | |
parent | 046f366e1f748130ae00c8a214b100492a50a394 (diff) |
Push an EOF onto the subtitle fifos from the reader for DVD VOBSUBs and also from cc608 for closed captions
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2388 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index b102b49f7..39be41310 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -414,7 +414,7 @@ static void SyncVideo( hb_work_object_t * w ) * What about discontinuity boundaries - not delt * with here - Van? */ - if( sub->start < cur->start ) + if( sub->size == 0 || sub->start < cur->start ) { sub = hb_fifo_get( subtitle->fifo_raw ); sub->start = pv->next_start; @@ -431,6 +431,14 @@ static void SyncVideo( hb_work_object_t * w ) hb_buffer_t * sub2; while( ( sub = hb_fifo_see( subtitle->fifo_raw ) ) ) { + if( sub->size == 0 ) + { + /* + * EOF, pass it through immediately. + */ + break; + } + /* If two subtitles overlap, make the first one stop when the second one starts */ sub2 = hb_fifo_see2( subtitle->fifo_raw ); @@ -468,6 +476,14 @@ static void SyncVideo( hb_work_object_t * w ) hb_buffer_close( &sub ); } + if( sub && sub->size == 0 ) + { + /* + * Continue immediately on subtitle EOF + */ + break; + } + /* * There is a valid subtitle, is it time to display it? */ @@ -606,28 +622,43 @@ static void SyncVideo( hb_work_object_t * w ) if( sub && subtitle && subtitle->format == PICTURESUB ) { - if( subtitle->dest == RENDERSUB ) + if( sub->size > 0 ) { - /* - * Tack onto the video buffer for rendering - */ - buf_tmp->sub = hb_buffer_init( sub->size ); - buf_tmp->sub->x = sub->x; - buf_tmp->sub->y = sub->y; - buf_tmp->sub->width = sub->width; - buf_tmp->sub->height = sub->height; - memcpy( buf_tmp->sub->data, sub->data, sub->size ); + if( subtitle->dest == RENDERSUB ) + { + /* + * Tack onto the video buffer for rendering + */ + buf_tmp->sub = hb_buffer_init( sub->size ); + buf_tmp->sub->x = sub->x; + buf_tmp->sub->y = sub->y; + buf_tmp->sub->width = sub->width; + buf_tmp->sub->height = sub->height; + memcpy( buf_tmp->sub->data, sub->data, sub->size ); + } else { + /* + * Pass-Through, pop it off of the raw queue, rewrite times and + * make it available to be muxed. + */ + uint64_t sub_duration; + sub = hb_fifo_get( subtitle->fifo_raw ); + sub_duration = sub->stop - sub->start; + sub->start = buf_tmp->start; + sub->stop = sub->start + duration; + hb_fifo_push( subtitle->fifo_out, sub ); + } } else { /* - * Pass-Through, pop it off of the raw queue, rewrite times and - * make it available to be muxed. + * EOF - consume for rendered, else pass through */ - uint64_t sub_duration; - sub = hb_fifo_get( subtitle->fifo_raw ); - sub_duration = sub->stop - sub->start; - sub->start = buf_tmp->start; - sub->stop = sub->start + duration; - hb_fifo_push( subtitle->fifo_out, sub ); + if( subtitle->dest == RENDERSUB ) + { + sub = hb_fifo_get( subtitle->fifo_raw ); + hb_buffer_close( &sub ); + } else { + sub = hb_fifo_get( subtitle->fifo_raw ); + hb_fifo_push( subtitle->fifo_out, sub ); + } } } |