Merged the trunk r8887, r8891, r8314
This commit is contained in:
@@ -669,7 +669,7 @@ void CvCapture_FFMPEG::seek(int64_t _frame_number)
|
||||
|
||||
// if we have not grabbed a single frame before first seek, let's read the first frame
|
||||
// and get some valuable information during the process
|
||||
if( first_frame_number < 0 )
|
||||
if( first_frame_number < 0 && get_total_frames() > 1 )
|
||||
grabFrame();
|
||||
|
||||
for(;;)
|
||||
@@ -679,7 +679,7 @@ void CvCapture_FFMPEG::seek(int64_t _frame_number)
|
||||
int64_t time_stamp = ic->streams[video_stream]->start_time;
|
||||
double time_base = r2d(ic->streams[video_stream]->time_base);
|
||||
time_stamp += (int64_t)(sec / time_base + 0.5);
|
||||
av_seek_frame(ic, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD);
|
||||
if (get_total_frames() > 1) av_seek_frame(ic, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD);
|
||||
avcodec_flush_buffers(ic->streams[video_stream]->codec);
|
||||
if( _frame_number > 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user