renderer: add null checks
This commit is contained in:
@@ -402,6 +402,10 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim
|
|||||||
|
|
||||||
void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJob &stream, const rational &input_time)
|
void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJob &stream, const rational &input_time)
|
||||||
{
|
{
|
||||||
|
if (!render_ctx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ticket_->property("type").value<RenderManager::TicketType>() != RenderManager::kTypeVideo) {
|
if (ticket_->property("type").value<RenderManager::TicketType>() != RenderManager::kTypeVideo) {
|
||||||
// Video cannot contribute to audio, so we do nothing here
|
// Video cannot contribute to audio, so we do nothing here
|
||||||
return;
|
return;
|
||||||
@@ -508,7 +512,9 @@ void RenderProcessor::ProcessAudioFootage(SampleBuffer &destination, const Foota
|
|||||||
|
|
||||||
void RenderProcessor::ProcessShader(TexturePtr destination, const Node *node, const TimeRange &range, const ShaderJob &job)
|
void RenderProcessor::ProcessShader(TexturePtr destination, const Node *node, const TimeRange &range, const ShaderJob &job)
|
||||||
{
|
{
|
||||||
Q_UNUSED(range)
|
if (!render_ctx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString full_shader_id = QStringLiteral("%1:%2").arg(node->id(), job.GetShaderID());
|
QString full_shader_id = QStringLiteral("%1:%2").arg(node->id(), job.GetShaderID());
|
||||||
|
|
||||||
@@ -562,11 +568,19 @@ void RenderProcessor::ProcessSamples(SampleBuffer &destination, const Node *node
|
|||||||
|
|
||||||
void RenderProcessor::ProcessColorTransform(TexturePtr destination, const Node *node, const ColorTransformJob &job)
|
void RenderProcessor::ProcessColorTransform(TexturePtr destination, const Node *node, const ColorTransformJob &job)
|
||||||
{
|
{
|
||||||
|
if (!render_ctx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
render_ctx_->BlitColorManaged(job, destination.get());
|
render_ctx_->BlitColorManaged(job, destination.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderProcessor::ProcessFrameGeneration(TexturePtr destination, const Node *node, const GenerateJob &job)
|
void RenderProcessor::ProcessFrameGeneration(TexturePtr destination, const Node *node, const GenerateJob &job)
|
||||||
{
|
{
|
||||||
|
if (!render_ctx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FramePtr frame = Frame::Create();
|
FramePtr frame = Frame::Create();
|
||||||
|
|
||||||
frame->set_video_params(destination->params());
|
frame->set_video_params(destination->params());
|
||||||
@@ -582,8 +596,21 @@ bool RenderProcessor::CanCacheFrames()
|
|||||||
return ticket_->property("type").value<RenderManager::TicketType>() == RenderManager::kTypeVideo;
|
return ticket_->property("type").value<RenderManager::TicketType>() == RenderManager::kTypeVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TexturePtr RenderProcessor::CreateTexture(const VideoParams &p)
|
||||||
|
{
|
||||||
|
if (render_ctx_) {
|
||||||
|
return render_ctx_->CreateTexture(p);
|
||||||
|
} else {
|
||||||
|
return super::CreateTexture(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RenderProcessor::ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs)
|
void RenderProcessor::ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs)
|
||||||
{
|
{
|
||||||
|
if (!render_ctx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
||||||
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, input_cs, color_manager->GetReferenceColorSpace());
|
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, input_cs, color_manager->GetReferenceColorSpace());
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,7 @@ protected:
|
|||||||
|
|
||||||
virtual bool CanCacheFrames() override;
|
virtual bool CanCacheFrames() override;
|
||||||
|
|
||||||
virtual TexturePtr CreateTexture(const VideoParams &p) override
|
virtual TexturePtr CreateTexture(const VideoParams &p) override;
|
||||||
{
|
|
||||||
return render_ctx_->CreateTexture(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual SampleBuffer CreateSampleBuffer(const AudioParams ¶ms, int sample_count) override
|
virtual SampleBuffer CreateSampleBuffer(const AudioParams ¶ms, int sample_count) override
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user