OSDN Git Service

libhb: don't truncate last chapter of a stream
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 9 Aug 2009 16:51:44 +0000 (16:51 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 9 Aug 2009 16:51:44 +0000 (16:51 +0000)
When an ffmpeg stream doesn't have chapters, we insert a dummy chapter
into our chapter list that has the same duration as the title. But the
title duration is only a guess. Later, when the chapter end time is reached,
we increment the chapter number. In the reader, we exit if the current
chapter number is greater than the last chapter. This patch only increments
the chapter number in stream if there is actually another chapter. This
way reader will continue till the file is exhausted

git-svn-id: svn://localhost/HandBrake/trunk@2757 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index 9c03490..8aa61a1 100644 (file)
@@ -2900,9 +2900,10 @@ static int ffmpeg_read( hb_stream_t *stream, hb_buffer_t *buf )
     if ( buf->id == stream->ffmpeg_video_id && buf->start >= stream->chapter_end )
     {
         hb_chapter_t *chapter = hb_list_item( stream->title->list_chapter,
-                                              ++stream->chapter );
+                                              stream->chapter+1 );
         if( chapter )
         {
+            stream->chapter++;
             stream->chapter_end += chapter->duration;
             buf->new_chap = stream->chapter + 1;
             hb_deep_log( 2, "ffmpeg_read starting chapter %i at %"PRId64,