mirror of
https://github.com/wang-bin/QtAV.git
synced 2026-10-28 19:16:48 +08:00
seek backward to a key frame for accurate seek
This commit is contained in:
+4
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user