decklink: Fix support for HW without output

Devices suitable for decklinksrc may not have any output, hence querying
the input returns NULL. Add support for all cases where
input/output/config may be missing.

https://bugzilla.gnome.org/show_bug.cgi?id=727306
This commit is contained in:
Nicolas Dufresne 2014-03-29 18:34:26 -04:00
parent 68309bd215
commit 1c1cc73a3b
3 changed files with 18 additions and 0 deletions

View file

@ -244,6 +244,11 @@ init_devices (void)
ret = iterator->Next (&decklink);
i++;
if (i == 10) {
GST_WARNING ("this hardware has more then 10 devices");
break;
}
}
n_devices = i;

View file

@ -321,6 +321,7 @@ gst_decklink_sink_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* FIXME: post error messages for the misc. failures */
static gboolean
gst_decklink_sink_start (GstDecklinkSink * decklinksink)
{
@ -335,6 +336,10 @@ gst_decklink_sink_start (GstDecklinkSink * decklinksink)
}
decklinksink->output = gst_decklink_get_nth_output (decklinksink->device_number);
if (!decklinksink->decklink) {
GST_WARNING ("no output for device %d", decklinksink->device_number);
return FALSE;
}
decklinksink->output->SetAudioCallback (decklinksink->callback);

View file

@ -424,6 +424,10 @@ gst_decklink_src_start (GstElement * element)
}
decklinksrc->input = gst_decklink_get_nth_input (decklinksrc->device_number);
if (decklinksrc->input == NULL) {
GST_ERROR ("no input source for device %i", decklinksrc->device_number);
return FALSE;
}
delegate = new DeckLinkCaptureDelegate ();
delegate->priv = decklinksrc;
@ -435,6 +439,10 @@ gst_decklink_src_start (GstElement * element)
decklinksrc->config = gst_decklink_get_nth_config (decklinksrc->device_number);
config = decklinksrc->config;
if (decklinksrc->config == NULL) {
GST_ERROR ("no config for device %i", decklinksrc->device_number);
return FALSE;
}
switch (decklinksrc->connection) {
default: