seek backward to a key frame for accurate seek

This commit is contained in:
wang-bin
2014-04-10 01:09:49 +08:00
parent ae092286d5
commit c6db720ffa
+4 -1
View File
@@ -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);
@@ -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;
}