diff options
-rw-r--r-- | libhb/decvobsub.c | 12 | ||||
-rw-r--r-- | libhb/sync.c | 30 |
2 files changed, 29 insertions, 13 deletions
diff --git a/libhb/decvobsub.c b/libhb/decvobsub.c index 102d7f0ce..9bd1b7808 100644 --- a/libhb/decvobsub.c +++ b/libhb/decvobsub.c @@ -208,7 +208,7 @@ static void ParseControls( hb_work_object_t * w ) int date, next; pv->pts_start = 0; - pv->pts_stop = 0; + pv->pts_stop = -1; pv->pts_forced = 0; pv->alpha[3] = 0; @@ -267,7 +267,7 @@ static void ParseControls( hb_work_object_t * w ) break; case 0x02: // 0x02 - STP_DSP - Stop Display, no arguments - if(!pv->pts_stop) + if(pv->pts_stop == -1) pv->pts_stop = pv->pts + date * 1024; break; @@ -343,7 +343,7 @@ static void ParseControls( hb_work_object_t * w ) } // fading-out - if( currAlpha < lastAlpha && !pv->pts_stop ) + if( currAlpha < lastAlpha && pv->pts_stop == -1 ) { pv->pts_stop = pv->pts + date * 1024; } @@ -377,12 +377,6 @@ static void ParseControls( hb_work_object_t * w ) } i = next; } - - if( !pv->pts_stop ) - { - /* Show it for 3 seconds */ - pv->pts_stop = pv->pts_start + 3 * 90000; - } } /*********************************************************************** diff --git a/libhb/sync.c b/libhb/sync.c index 6d7a778a5..eedaedbab 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -582,8 +582,18 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // If this subtitle track's packets are to be passed thru, do so immediately if( subtitle->config.dest == PASSTHRUSUB ) { - while ( ( sub = hb_fifo_get( subtitle->fifo_raw ) ) != NULL ) + while ( ( sub = hb_fifo_see( subtitle->fifo_raw ) ) != NULL ) { + if ( sub->stop == -1 && hb_fifo_size( subtitle->fifo_raw ) < 2 ) + break; + + sub = hb_fifo_get( subtitle->fifo_raw ); + if ( sub->stop == -1 ) + { + hb_buffer_t *next; + next = hb_fifo_see( subtitle->fifo_raw ); + sub->stop = next->start; + } // Need to re-write subtitle timestamps to account // for any slippage. hb_lock( pv->common->mutex ); @@ -633,13 +643,25 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, hb_buffer_t *cur_sub_tail = NULL; for ( sub = sync->sub_list; sub != NULL; ) { + if ( sub->next && sub->stop == -1 ) + { + sub->stop = sub->next->start; + } + // Need to re-write subtitle timestamps to account // for any slippage. hb_lock( pv->common->mutex ); sub_start = sub->start - pv->common->video_pts_slip; hb_unlock( pv->common->mutex ); - duration = sub->stop - sub->start; - sub_stop = sub_start + duration; + if ( sub->stop != -1 ) + { + duration = sub->stop - sub->start; + sub_stop = sub_start + duration; + } + else + { + sub_stop = -1; + } if ( cur->start < sub_start ) { @@ -649,7 +671,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, else { // Subtitle starts now or in the past... - if ( cur->start < sub_stop ) + if ( cur->start < sub_stop || sub_stop == -1 ) { // Subtitle finishes in the future |