ffmpeg: use best effort timestamp instead of pts
This commit is contained in:
@@ -323,7 +323,7 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, const QAtomicIn
|
|||||||
int64_t new_dur;
|
int64_t new_dur;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
new_dur = frame->pts;
|
new_dur = frame->best_effort_timestamp;
|
||||||
} while (instance.GetFrame(pkt, frame) >= 0);
|
} while (instance.GetFrame(pkt, frame) >= 0);
|
||||||
|
|
||||||
avstream->duration = new_dur;
|
avstream->duration = new_dur;
|
||||||
@@ -388,7 +388,7 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, const QAtomicIn
|
|||||||
int64_t new_dur;
|
int64_t new_dur;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
new_dur = frame->pts;
|
new_dur = frame->best_effort_timestamp;
|
||||||
} while (instance.GetFrame(pkt, frame) >= 0);
|
} while (instance.GetFrame(pkt, frame) >= 0);
|
||||||
|
|
||||||
avstream->duration = new_dur;
|
avstream->duration = new_dur;
|
||||||
@@ -540,7 +540,7 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector<QString> &filenames, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalProcessingProgress(frame->pts, duration);
|
SignalProcessingProgress(frame->best_effort_timestamp, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
wave_out.close();
|
wave_out.close();
|
||||||
@@ -733,7 +733,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c
|
|||||||
if (still_seeking) {
|
if (still_seeking) {
|
||||||
// Handle a failure to seek (occurs on some media)
|
// Handle a failure to seek (occurs on some media)
|
||||||
// We'll only be here if the frame cache was emptied earlier
|
// We'll only be here if the frame cache was emptied earlier
|
||||||
if (!cache_at_zero_ && (ret == AVERROR_EOF || working_frame->pts > target_ts)) {
|
if (!cache_at_zero_ && (ret == AVERROR_EOF || working_frame->best_effort_timestamp > target_ts)) {
|
||||||
|
|
||||||
seek_ts = qMax(min_seek, seek_ts - second_ts_);
|
seek_ts = qMax(min_seek, seek_ts - second_ts_);
|
||||||
instance_.Seek(seek_ts);
|
instance_.Seek(seek_ts);
|
||||||
@@ -784,7 +784,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c
|
|||||||
av_image_copy(&destination_data, &destination_linesize, const_cast<const uint8_t**>(working_frame->data), working_frame->linesize, static_cast<AVPixelFormat>(working_frame->format), working_frame->width, working_frame->height);
|
av_image_copy(&destination_data, &destination_linesize, const_cast<const uint8_t**>(working_frame->data), working_frame->linesize, static_cast<AVPixelFormat>(working_frame->format), working_frame->width, working_frame->height);
|
||||||
|
|
||||||
// Set timestamp so this frame can be identified later
|
// Set timestamp so this frame can be identified later
|
||||||
cached->set_timestamp(working_frame->pts);
|
cached->set_timestamp(working_frame->best_effort_timestamp);
|
||||||
|
|
||||||
// Store frame before just in case
|
// Store frame before just in case
|
||||||
FFmpegFramePool::ElementPtr previous;
|
FFmpegFramePool::ElementPtr previous;
|
||||||
|
|||||||
Reference in New Issue
Block a user