diff options
author | eddyg <[email protected]> | 2009-05-05 04:49:28 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2009-05-05 04:49:28 +0000 |
commit | 5d3a0ec24c831e9f5f1875f62613e64b45a62e27 (patch) | |
tree | c75e3de94e1cd9b60945dcd9922fb6ee4d0b4ba0 /libhb/sync.c | |
parent | ec848fee96e7cbfbb2037b1908978ebe45543e54 (diff) |
Rewrite pass-through timestamps in sync, put on subtitle->fifo_out for muxing. Also put the mp4 subtitle display inline with muxing - easy for ritsuka to put into a subtitle track ;)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2384 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 72 |
1 files changed, 59 insertions, 13 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 798c01b26..b102b49f7 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -394,7 +394,39 @@ static void SyncVideo( hb_work_object_t * w ) for( i = 0; i < hb_list_count( job->list_subtitle ); i++) { subtitle = hb_list_item( job->list_subtitle, i ); - if( subtitle->dest == RENDERSUB ) + + /* + * Rewrite timestamps on subtitles that need it (on raw queue). + */ + if( subtitle->source == CCSUB ) + { + /* + * Rewrite timestamps on subtitles that came from Closed Captions + * since they are using the MPEG2 timestamps. + */ + while( ( sub = hb_fifo_see( subtitle->fifo_raw ) ) ) + { + /* + * Rewrite the timestamps as and when the video + * (cur->start) reaches the same timestamp as a + * closed caption (sub->start). + * + * What about discontinuity boundaries - not delt + * with here - Van? + */ + if( sub->start < cur->start ) + { + sub = hb_fifo_get( subtitle->fifo_raw ); + sub->start = pv->next_start; + hb_fifo_push( subtitle->fifo_out, sub ); + } else { + sub = NULL; + break; + } + } + } + + if( subtitle->source == VOBSUB ) { hb_buffer_t * sub2; while( ( sub = hb_fifo_see( subtitle->fifo_raw ) ) ) @@ -528,11 +560,7 @@ static void SyncVideo( hb_work_object_t * w ) if( sub ) { /* - * Don't overwrite the current sub, we'll check the - * other subtitle streams on the next video buffer. - * - * It doesn't make much sense having multiple rendered - * subtitle tracks anyway. + * Got a sub to display... */ break; } @@ -575,14 +603,32 @@ static void SyncVideo( hb_work_object_t * w ) /* If we have a subtitle for this picture, copy it */ /* FIXME: we should avoid this memcpy */ - if( sub ) + if( sub && subtitle && + subtitle->format == PICTURESUB ) { - 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 ); + } } /* Push the frame to the renderer */ |