Skip to content

Commit

Permalink
seek backward to a key frame for accurate seek
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Apr 9, 2014
1 parent ae09228 commit c6db720
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/AVDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ AVDemuxer::AVDemuxer(const QString& fileName, QObject *parent)
, _file_name(fileName)
, m_pQAVIO(0)
, mSeekUnit(SeekByTime)
, mSeekTarget(SeekTarget_KeyFrame)
, mSeekTarget(SeekTarget_AccurateFrame)
, mpDict(0)
{
mpInterrup = new InterruptHandler(this);
Expand Down Expand Up @@ -379,6 +379,9 @@ bool AVDemuxer::seek(qint64 pos)
* from AV_TIME_BASE units to the stream specific time_base.
*/
int seek_flag = (backward ? AVSEEK_FLAG_BACKWARD : 0);
if (mSeekTarget == SeekTarget_AccurateFrame) {
seek_flag = AVSEEK_FLAG_BACKWARD;
}
if (mSeekTarget == SeekTarget_AnyFrame) {
seek_flag = AVSEEK_FLAG_ANY;
}
Expand Down

0 comments on commit c6db720

Please sign in to comment.