From 593765ab9ee887acec8573339bad3667f3e796d9 Mon Sep 17 00:00:00 2001 From: van Date: Sat, 10 Jan 2009 04:47:48 +0000 Subject: Get previews from H.264 content even if it's missing IDR frames (e.g., NZ TV & some blu-rays): - Grab stream characteristics (IDRs or not, PCRs or not, RAPs or not) while we're reading to compute the duration rather than trying to guess with no information later. - Only wait for an IDR after a seek if we know the stream has IDRs. Even then, wait for at most 255 frames. - If the stream doesn't have IDRs tell scan (via a new flag in the title struct) so that it can read but discard a second's worth of frames to get the decoder in sync withe stream. - While we're trying to sync the decoder, ffmpeg will spit out dozens of useless error messages so suppress them. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2071 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/decavcodec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libhb/decavcodec.c') diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 287099165..5dd22244c 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -550,13 +550,22 @@ static void flushDelayQueue( hb_work_private_t *pv ) static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size ) { - int got_picture; + int got_picture, oldlevel = 0; AVFrame frame; + if ( global_verbosity_level <= 1 ) + { + oldlevel = av_log_get_level(); + av_log_set_level( AV_LOG_QUIET ); + } if ( avcodec_decode_video( pv->context, &frame, &got_picture, data, size ) < 0 ) { ++pv->decode_errors; } + if ( global_verbosity_level <= 1 ) + { + av_log_set_level( oldlevel ); + } if( got_picture ) { // ffmpeg makes it hard to attach a pts to a frame. if the MPEG ES -- cgit v1.2.3