diff options
-rw-r--r-- | libhb/scan.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libhb/scan.c b/libhb/scan.c index 74d960117..d116f6815 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -497,6 +497,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) int interlaced_preview_count = 0; int frame_wait = 0; int cc_wait = 10; + int frames; 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 ); @@ -611,6 +612,14 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) frame_wait = 10; } } + else + { + // For certain mpeg-2 streams, libav is delivering a + // dummy first frame that is all black. So always skip + // one frame + frame_wait = 1; + } + frames = 0; hb_buffer_t * vid_buf = NULL; @@ -693,7 +702,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) // additional frames to find the CCs. if (vid_buf != NULL && (frame_wait || cc_wait)) { - if (vid_buf->s.frametype == HB_FRAME_I) + if (frames > 0 && vid_buf->s.frametype == HB_FRAME_I) frame_wait = 0; if (frame_wait || cc_wait) { @@ -701,6 +710,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title, int flush ) if (frame_wait) frame_wait--; if (cc_wait) cc_wait--; } + frames++; } } else if( ! AllAudioOK( title ) ) |