Skip to content

Commit a35585f

Browse files
author
Clement Champetier
committed
hotfix: InputFile::seek at the exact frame
Update documentation of InputFile::seekxxx functions.
1 parent 5fb1558 commit a35585f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/AvTranscoder/file/InputFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ bool InputFile::readNextPacket( CodedData& data, const size_t streamIndex )
8686
void InputFile::seekAtFrame( const size_t frame )
8787
{
8888
uint64_t position = frame / getFps() * AV_TIME_BASE;
89-
_formatContext.seek( position, AVSEEK_FLAG_BACKWARD );
89+
_formatContext.seek( position, AVSEEK_FLAG_ANY );
9090
}
9191

9292
void InputFile::seekAtTime( const double time )
9393
{
9494
uint64_t position = time * AV_TIME_BASE;
95-
_formatContext.seek( position, AVSEEK_FLAG_BACKWARD );
95+
_formatContext.seek( position, AVSEEK_FLAG_ANY );
9696
}
9797

9898
void InputFile::activateStream( const size_t streamIndex, bool activate )

src/AvTranscoder/file/InputFile.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class AvExport InputFile
4848
bool readNextPacket( CodedData& data, const size_t streamIndex );
4949

5050
/**
51-
* @brief Seek input stream at specified frame
52-
* @note clean also buffers in each InputStream
53-
* @return if next packet was read succefully
51+
* @brief Seek at a specific frame / time (in seconds)
52+
* @note Seek in file by using the default stream (according to ffmpeg)
53+
* @warning If the seek is done to a non key-frame, the decoding will start from the next key-frame
5454
**/
5555
void seekAtFrame( const size_t frame );
5656
void seekAtTime( const double time );

0 commit comments

Comments
 (0)