diff options
author | jstebbins <[email protected]> | 2011-10-07 23:17:09 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-10-07 23:17:09 +0000 |
commit | 9644dab2185e9ef0bbfac987f94911cc8cfda345 (patch) | |
tree | eb85bfba47dab2fbaeafe5388bbf374c8f6d46fd /libhb/muxmp4.c | |
parent | 4584917714e9d7abee8cef345aa40de14dae0e33 (diff) |
Check for negative stop times in subtitles
A subtitle may not have a stop time. Set it to something reasonable
when missing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4268 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxmp4.c')
-rw-r--r-- | libhb/muxmp4.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index c1ac9994c..8d93d361a 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -1104,6 +1104,13 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, } else { + int64_t duration; + + if( buf->stop < 0 ) + duration = 90000L * 10; + else + duration = buf->stop - buf->start; + /* Write an empty sample */ if ( mux_data->sum_dur < buf->start ) { @@ -1141,7 +1148,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, hb_deep_log(3, "MuxMP4:Sub:%fs:%"PRId64":%"PRId64":%"PRId64": %s", (float)buf->start / 90000, buf->start, buf->stop, - (buf->stop - buf->start), buffer); + duration, buffer); /* Write the subtitle sample */ memcpy( output + 2, buffer, buffersize ); @@ -1153,7 +1160,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, mux_data->track, output, buffersize + stylesize + 2, - buf->stop - buf->start, + duration, 0, 1 )) { @@ -1161,11 +1168,18 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, *job->die = 1; } - mux_data->sum_dur += (buf->stop - buf->start); + mux_data->sum_dur += duration; } } else if( mux_data->sub_format == PICTURESUB ) { + int64_t duration; + + if( buf->stop < 0 ) + duration = 90000L * 10; + else + duration = buf->stop - buf->start; + /* Write an empty sample */ if ( mux_data->sum_dur < buf->start ) { @@ -1187,7 +1201,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, mux_data->track, buf->data, buf->size, - buf->stop - buf->start, + duration, 0, 1 )) { @@ -1195,7 +1209,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, *job->die = 1; } - mux_data->sum_dur += (buf->stop - buf->start); + mux_data->sum_dur += duration; } } else |