summaryrefslogtreecommitdiffstats
path: root/libhb/scan.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-10-02 21:05:08 +0000
committerjstebbins <[email protected]>2014-10-02 21:05:08 +0000
commit7265c862c042e81f0b86e7df8b58ee69d9cb9e83 (patch)
tree9289bb66d25218890c73331c55f91dedb57688a0 /libhb/scan.c
parent9254fa47939e055f39f1cd5f8db52268d498558d (diff)
libhb: improve preview generateion when there are no IDRs
Puts the decoder into a mode that returns *all* frames. I.e. it won't just scan to the end of the file looking for an IDR. Then we decode multiple frames (up to 100) searching for an I frame. This way, the reconstructed frame we use for a preview is more likely to be complete. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6430 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/scan.c')
-rw-r--r--libhb/scan.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libhb/scan.c b/libhb/scan.c
index 5726e8a5d..08b8e9e24 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -493,6 +493,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush )
int pulldown_count = 0;
int doubled_frame_count = 0;
int interlaced_preview_count = 0;
+ int frame_wait = 0;
hb_stream_t * stream = NULL;
info_list_t * info_list = calloc( data->preview_count+1, sizeof(*info_list) );
crop_record_t *crops = crop_record_init( data->preview_count );
@@ -590,6 +591,10 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush )
if (flush && vid_decoder->flush)
vid_decoder->flush( vid_decoder );
+ if (title->flags & HBTF_NO_IDR)
+ {
+ frame_wait = 100;
+ }
hb_buffer_t * vid_buf = NULL;
@@ -660,6 +665,18 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush )
if( buf_es->s.id == title->video_id && vid_buf == NULL )
{
vid_decoder->work( vid_decoder, &buf_es, &vid_buf );
+ if (vid_buf != NULL && frame_wait)
+ {
+ if (vid_buf->s.frametype != HB_FRAME_I)
+ {
+ hb_buffer_close(&vid_buf);
+ frame_wait--;
+ }
+ else
+ {
+ frame_wait = 0;
+ }
+ }
}
else if( ! AllAudioOK( title ) )
{