fixed bug where an unindexed video would cache a blank first frame
This commit is contained in:
@@ -478,6 +478,10 @@ void FFmpegDecoder::Index()
|
|||||||
|
|
||||||
// Save index to file
|
// Save index to file
|
||||||
SaveFrameIndex();
|
SaveFrameIndex();
|
||||||
|
|
||||||
|
// Reset state
|
||||||
|
avcodec_flush_buffers(codec_ctx_);
|
||||||
|
av_seek_frame(fmt_ctx_, avstream_->index, 0, AVSEEK_FLAG_BACKWARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FFmpegDecoder::GetIndexFilename()
|
QString FFmpegDecoder::GetIndexFilename()
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ QVariant NodeInput::get_value(const rational& time)
|
|||||||
// Retrieve the value
|
// Retrieve the value
|
||||||
if (!edges_.isEmpty()) {
|
if (!edges_.isEmpty()) {
|
||||||
// A connection - use the output of the connected Node
|
// A connection - use the output of the connected Node
|
||||||
value_ = edges_.first()->output()->get_value(time);
|
value_ = get_connected_output()->get_value(time);
|
||||||
} else {
|
} else {
|
||||||
// No connections - use the internal value
|
// No connections - use the internal value
|
||||||
// FIXME: Re-implement keyframing
|
// FIXME: Re-implement keyframing
|
||||||
|
|||||||
@@ -132,16 +132,15 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to get a frame or not
|
// Check if we need to get a frame or not
|
||||||
if (frame_ == nullptr || frame_native_ts_ != decoder_->GetTimestampFromTime(time)) {
|
if (frame_ == nullptr || frame_->native_timestamp() != decoder_->GetTimestampFromTime(time)) {
|
||||||
// Get frame from Decoder
|
// Get frame from Decoder
|
||||||
frame_ = decoder_->Retrieve(time);
|
frame_ = decoder_->Retrieve(time);
|
||||||
|
|
||||||
if (frame_ == nullptr) {
|
if (frame_ == nullptr) {
|
||||||
|
qDebug() << "Received a null frame while time was" << time.toDouble();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_native_ts_ = frame_->native_timestamp();
|
|
||||||
|
|
||||||
if (color_service_ == nullptr) {
|
if (color_service_ == nullptr) {
|
||||||
// FIXME: Hardcoded values for testing
|
// FIXME: Hardcoded values for testing
|
||||||
color_service_ = std::make_shared<ColorService>("srgb", OCIO::ROLE_SCENE_LINEAR);
|
color_service_ = std::make_shared<ColorService>("srgb", OCIO::ROLE_SCENE_LINEAR);
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ private:
|
|||||||
GLuint ocio_texture_;
|
GLuint ocio_texture_;
|
||||||
|
|
||||||
FramePtr frame_;
|
FramePtr frame_;
|
||||||
int64_t frame_native_ts_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -287,6 +287,11 @@ const rational &NodeParam::LastRequestedTime()
|
|||||||
return time_;
|
return time_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NodeParam::ValueCachingEnabled()
|
||||||
|
{
|
||||||
|
return value_caching_;
|
||||||
|
}
|
||||||
|
|
||||||
void NodeParam::SetValueCachingEnabled(bool enabled)
|
void NodeParam::SetValueCachingEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
value_caching_ = enabled;
|
value_caching_ = enabled;
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const rational& LastRequestedTime();
|
const rational& LastRequestedTime();
|
||||||
|
|
||||||
|
bool ValueCachingEnabled();
|
||||||
void SetValueCachingEnabled(bool enabled);
|
void SetValueCachingEnabled(bool enabled);
|
||||||
|
|
||||||
virtual DataType data_type() = 0;
|
virtual DataType data_type() = 0;
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ void RendererProcessor::CacheNext()
|
|||||||
|
|
||||||
rational cache_frame = cache_queue_.takeFirst();
|
rational cache_frame = cache_queue_.takeFirst();
|
||||||
|
|
||||||
//qDebug() << "[RendererProcessor] Caching" << cache_frame.toDouble();
|
qDebug() << "[RendererProcessor] Caching" << cache_frame.toDouble();
|
||||||
|
|
||||||
threads_.first()->Queue(NodeDependency(texture_input_->get_connected_output(), cache_frame), true);
|
threads_.first()->Queue(NodeDependency(texture_input_->get_connected_output(), cache_frame), true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user