summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-04-25 21:15:43 +0000
committerjstebbins <[email protected]>2010-04-25 21:15:43 +0000
commitc22e82ad0081856466a92a6e47a72b3ea9b5628c (patch)
tree4118bfdb4913105820b98e7317021704c8f39faa /libhb/stream.c
parente6ba7dc071b0b1f070b7f92e3b30eab1ee00a0b5 (diff)
bump ffmpeg to rev 22950
offset ffmpeg seeks by value of initial timestamp since it can be non-zero catch pix fmt that is unsupported by swscale, log it, skip the track use new ffmpeg avg_frame_rate for more accurate framerate estimate git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3267 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/stream.c')
-rw-r--r--libhb/stream.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index d2d2a4a47..caed365cd 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -1259,6 +1259,14 @@ int hb_stream_read( hb_stream_t * src_stream, hb_buffer_t * b )
return hb_ts_stream_decode( src_stream, b );
}
+int64_t ffmpeg_initial_timestamp( hb_stream_t * stream )
+{
+ AVStream *s = stream->ffmpeg_ic->streams[stream->ffmpeg_video_id];
+ if ( s->nb_index_entries < 1 )
+ return 0;
+
+ return s->index_entries[0].timestamp;
+}
int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
{
@@ -1284,7 +1292,7 @@ int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
stream->chapter = chapter_num - 1;
stream->chapter_end = sum_dur;
- int64_t pos = ( ( ( sum_dur - chapter->duration ) * AV_TIME_BASE ) / 90000 );
+ int64_t pos = ( ( ( sum_dur - chapter->duration ) * AV_TIME_BASE ) / 90000 ) + ffmpeg_initial_timestamp( stream );
hb_deep_log( 2, "Seeking to chapter %d: starts %"PRId64", ends %"PRId64", AV pos %"PRId64,
chapter_num, sum_dur - chapter->duration, sum_dur, pos);
@@ -1302,7 +1310,7 @@ int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
// that causes the problem. since hb_stream_seek_chapter
// is called before we start reading, make sure
// we do a seek here.
- av_seek_frame( stream->ffmpeg_ic, -1, 0LL, AVSEEK_FLAG_BACKWARD );
+ av_seek_frame( stream->ffmpeg_ic, -1, ffmpeg_initial_timestamp( stream ), AVSEEK_FLAG_BACKWARD );
}
return 1;
}
@@ -2857,6 +2865,13 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream )
avcodec_find_decoder( ic->streams[i]->codec->codec_id ) &&
title->video_codec == 0 )
{
+ AVCodecContext *context = ic->streams[i]->codec;
+ if ( context->pix_fmt != PIX_FMT_YUV420P &&
+ !sws_isSupportedInput( context->pix_fmt ) )
+ {
+ hb_log( "ffmpeg_title_scan: Unsupported color space" );
+ continue;
+ }
title->video_id = i;
stream->ffmpeg_video_id = i;
@@ -3116,7 +3131,7 @@ static int ffmpeg_seek_ts( hb_stream_t *stream, int64_t ts )
AVFormatContext *ic = stream->ffmpeg_ic;
int64_t pos;
- pos = ts * AV_TIME_BASE / 90000;
+ pos = ts * AV_TIME_BASE / 90000 + ffmpeg_initial_timestamp( stream );
stream->need_keyframe = 1;
// Seek to the nearest timestamp before that requested where
// there is an I-frame