decklinkvideosink: Do nothing if set_caps() is called with basically the same caps again

and error out here already otherwise. We currently don't support
reconfiguration here and it can't happen really either unless the auto
mode is selected.
This commit is contained in:
Sebastian Dröge 2017-02-01 16:45:53 +02:00
parent 21a9a89851
commit 8d723c5fe1

View file

@ -336,12 +336,32 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
const GstDecklinkMode *mode; const GstDecklinkMode *mode;
HRESULT ret; HRESULT ret;
BMDVideoOutputFlags flags; BMDVideoOutputFlags flags;
GstVideoInfo info;
GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps);
if (!gst_video_info_from_caps (&self->info, caps)) if (!gst_video_info_from_caps (&info, caps))
return FALSE; return FALSE;
g_mutex_lock (&self->output->lock);
if (self->output->video_enabled) {
if (self->info.finfo->format == info.finfo->format &&
self->info.width == info.width && self->info.height == info.height) {
// FIXME: We should also consider the framerate as it is used
// for mode selection below in auto mode
GST_DEBUG_OBJECT (self, "Nothing relevant has changed");
self->info = info;
g_mutex_unlock (&self->output->lock);
return TRUE;
} else {
GST_DEBUG_OBJECT (self, "Reconfiguration not supported at this point");
g_mutex_unlock (&self->output->lock);
return FALSE;
}
}
g_mutex_unlock (&self->output->lock);
self->output->output->SetScheduledFrameCompletionCallback (new self->output->output->SetScheduledFrameCompletionCallback (new
GStreamerVideoOutputCallback (self)); GStreamerVideoOutputCallback (self));
@ -387,6 +407,7 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
return FALSE; return FALSE;
} }
self->info = info;
g_mutex_lock (&self->output->lock); g_mutex_lock (&self->output->lock);
self->output->mode = mode; self->output->mode = mode;
self->output->video_enabled = TRUE; self->output->video_enabled = TRUE;