X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fffmpeg.C;h=ce3d704461ffd0b009b27ed187df70880fe2ee57;hp=7f0b5b77431c1f6ed987fff889400a39077a3865;hb=058cf29dcce79444cb57da22ae03d9f2abff745e;hpb=94e8dc2b306135e7735b2618a54f0f7de7ac7a0c diff --git a/cinelerra-5.0/cinelerra/ffmpeg.C b/cinelerra-5.0/cinelerra/ffmpeg.C index 7f0b5b77..ce3d7044 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.C +++ b/cinelerra-5.0/cinelerra/ffmpeg.C @@ -626,12 +626,12 @@ int FFVideoStream::decode_frame(AVFrame *frame, int &got_frame) int FFVideoStream::load(VFrame *vframe, int64_t pos) { - if( video_seek(pos) < 0 ) return -1; + int ret = video_seek(pos); + if( ret < 0 ) return -1; if( !frame && !(frame=av_frame_alloc()) ) { fprintf(stderr, "FFVideoStream::load: av_frame_alloc failed\n"); return -1; } - int ret = 0; for( int i=0; ret>=0 && !flushed && curr_pos<=pos && i<1000; ++i ) { ret = read_frame(frame); } @@ -653,6 +653,7 @@ int FFVideoStream::video_seek(int64_t pos) if( gop < 4 ) gop = 4; if( gop > 64 ) gop = 64; if( pos >= curr_pos && pos <= curr_pos + gop ) return 0; + if( pos == curr_pos-1 && curr_pos > seek_pos ) return 1; if( !st->codec || !st->codec->codec ) return -1; avcodec_flush_buffers(st->codec); // back up a few frames to read up to current to help repair damages