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/muxmp4.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/muxmp4.c')
-rw-r--r-- | libhb/muxmp4.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 81ee2f8ad..bdeea8c42 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -437,6 +437,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, hb_job_t * job = m->job; int64_t duration; int64_t offset = 0; + int i; if( mux_data == job->mux_data ) { @@ -583,6 +584,34 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, } } + for( i = 0; i < hb_list_count( job->list_subtitle ); i++ ) + { + hb_subtitle_t *subtitle = hb_list_item( job->list_subtitle, i ); + + if( subtitle && subtitle->format == TEXTSUB && + subtitle->dest == PASSTHRUSUB ) + { + /* + * Should be adding this one if the timestamp is right. + */ + hb_buffer_t *sub; + + while( ( sub = hb_fifo_see( subtitle->fifo_out )) != NULL ) + { + if (sub->start < buf->start ) { + sub = hb_fifo_get( subtitle->fifo_out ); + hb_log("MuxMP4: Text Sub:%lld: %s", sub->start, sub->data); + hb_buffer_close( &sub ); + } else { + /* + * Not time yet + */ + break; + } + } + } + } + return 0; } @@ -590,7 +619,6 @@ static int MP4End( hb_mux_object_t * m ) { hb_job_t * job = m->job; hb_title_t * title = job->title; - int i; /* Write our final chapter marker */ if( m->job->chapter_markers ) @@ -667,37 +695,6 @@ static int MP4End( hb_mux_object_t * m ) MP4TagsFree( tags ); } - /* - * Display any text subs. - * - * This is placeholder code, what needs to happen is that we need to - * convert these PTS (which are pre-sync ones) into HB timestamps, - * I guess sync should do that? - * - * And then this needs to move into the Mux code above and insert - * subtitle samples into the MP4 at the correct times. - */ - for( i = 0; i < hb_list_count( job->list_subtitle ); i++ ) - { - hb_subtitle_t *subtitle = hb_list_item( job->list_subtitle, i ); - - if( subtitle && subtitle->format == TEXTSUB && - subtitle->dest == PASSTHRUSUB ) - { - /* - * Should be adding this one if the timestamp is right. - */ - hb_buffer_t *buffer; - - while( (buffer = hb_fifo_get( subtitle->fifo_raw )) != NULL ) - { - hb_log("MuxMP4: Text Sub: %s", buffer->data); - - hb_buffer_close( &buffer ); - } - } - } - MP4Close( m->file ); if ( job->mp4_optimize ) |