From f9a8b843df2ef45c2ae196ebb2b8ba2308227d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 21 Sep 2016 09:31:23 -0400 Subject: [PATCH] decklink: Print the Decklink API error return values in debug output in all places --- sys/decklink/gstdecklink.cpp | 15 ++++++++++----- sys/decklink/gstdecklinkaudiosink.cpp | 7 +++++-- sys/decklink/gstdecklinkaudiosrc.cpp | 4 ++-- sys/decklink/gstdecklinkvideosink.cpp | 2 +- sys/decklink/gstdecklinkvideosrc.cpp | 10 ++++++---- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp index c8eb7b3c82..184f124a92 100644 --- a/sys/decklink/gstdecklink.cpp +++ b/sys/decklink/gstdecklink.cpp @@ -764,7 +764,8 @@ public: } else { res = dtc->GetComponents (&hours, &minutes, &seconds, &frames); if (res != S_OK) { - GST_ERROR ("Could not get components for timecode %p", dtc); + GST_ERROR ("Could not get components for timecode %p: 0x%08x", dtc, + res); hours = 0; minutes = 0; seconds = 0; @@ -914,7 +915,8 @@ init_devices (gpointer data) ret = decklink->QueryInterface (IID_IDeckLinkInput, (void **) &devices[i].input.input); if (ret != S_OK) { - GST_WARNING ("selected device does not have input interface"); + GST_WARNING ("selected device does not have input interface: 0x%08x", + ret); } else { devices[i].input.device = decklink; devices[i].input.clock = gst_decklink_clock_new ("GstDecklinkInputClock"); @@ -928,7 +930,8 @@ init_devices (gpointer data) ret = decklink->QueryInterface (IID_IDeckLinkOutput, (void **) &devices[i].output.output); if (ret != S_OK) { - GST_WARNING ("selected device does not have output interface"); + GST_WARNING ("selected device does not have output interface: 0x%08x", + ret); } else { devices[i].output.device = decklink; devices[i].output.clock = @@ -940,14 +943,16 @@ init_devices (gpointer data) ret = decklink->QueryInterface (IID_IDeckLinkConfiguration, (void **) &devices[i].input.config); if (ret != S_OK) { - GST_WARNING ("selected device does not have config interface"); + GST_WARNING ("selected device does not have config interface: 0x%08x", + ret); } ret = decklink->QueryInterface (IID_IDeckLinkAttributes, (void **) &devices[i].input.attributes); devices[i].output.attributes = devices[i].input.attributes; if (ret != S_OK) { - GST_WARNING ("selected device does not have attributes interface"); + GST_WARNING ("selected device does not have attributes interface: 0x%08x", + ret); } ret = iterator->Next (&decklink); diff --git a/sys/decklink/gstdecklinkaudiosink.cpp b/sys/decklink/gstdecklinkaudiosink.cpp index 7075229fb5..1d631548f3 100644 --- a/sys/decklink/gstdecklinkaudiosink.cpp +++ b/sys/decklink/gstdecklinkaudiosink.cpp @@ -310,13 +310,16 @@ gst_decklink_audio_sink_ringbuffer_delay (GstAudioRingBuffer * rb) GstDecklinkAudioSinkRingBuffer *self = GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb); guint ret = 0; + HRESULT res = S_OK; if (self->output) { - if (self->output->output->GetBufferedAudioSampleFrameCount (&ret) != S_OK) + if ((res = + self->output->output->GetBufferedAudioSampleFrameCount (&ret)) != + S_OK) ret = 0; } - GST_DEBUG_OBJECT (self->sink, "Delay: %u", ret); + GST_DEBUG_OBJECT (self->sink, "Delay: %u (0x%08x)", ret, res); return ret; } diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp index 4a66e96bbe..5024bb558e 100644 --- a/sys/decklink/gstdecklinkaudiosrc.cpp +++ b/sys/decklink/gstdecklinkaudiosrc.cpp @@ -367,7 +367,7 @@ gst_decklink_audio_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) self->input->config->SetInt (bmdDeckLinkConfigAudioInputConnection, conn); if (ret != S_OK) { - GST_ERROR ("set configuration (audio input connection)"); + GST_ERROR ("set configuration (audio input connection): 0x%08x", ret); return FALSE; } } @@ -375,7 +375,7 @@ gst_decklink_audio_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) ret = self->input->input->EnableAudioInput (bmdAudioSampleRate48kHz, sample_depth, 2); if (ret != S_OK) { - GST_WARNING_OBJECT (self, "Failed to enable audio input"); + GST_WARNING_OBJECT (self, "Failed to enable audio input: 0x%08x", ret); return FALSE; } diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp index 9dca92cede..db7fa9d5b3 100644 --- a/sys/decklink/gstdecklinkvideosink.cpp +++ b/sys/decklink/gstdecklinkvideosink.cpp @@ -378,7 +378,7 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) ret = self->output->output->EnableVideoOutput (mode->mode, flags); if (ret != S_OK) { - GST_WARNING_OBJECT (self, "Failed to enable video output"); + GST_WARNING_OBJECT (self, "Failed to enable video output: 0x%08x", ret); return FALSE; } diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp index 05a853c6c9..d82c5fc730 100644 --- a/sys/decklink/gstdecklinkvideosrc.cpp +++ b/sys/decklink/gstdecklinkvideosrc.cpp @@ -346,7 +346,8 @@ gst_decklink_video_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) ret = self->input->config->SetInt (bmdDeckLinkConfigVideoInputConnection, gst_decklink_get_connection (self->connection)); if (ret != S_OK) { - GST_ERROR_OBJECT (self, "Failed to set configuration (input source)"); + GST_ERROR_OBJECT (self, + "Failed to set configuration (input source): 0x%08x", ret); return FALSE; } @@ -355,7 +356,7 @@ gst_decklink_video_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) bmdAnalogVideoFlagCompositeSetup75); if (ret != S_OK) { GST_ERROR_OBJECT (self, - "Failed to set configuration (composite setup)"); + "Failed to set configuration (composite setup): 0x%08x", ret); return FALSE; } } @@ -371,7 +372,8 @@ gst_decklink_video_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) attributes->GetFlag (BMDDeckLinkSupportsInputFormatDetection, &autoDetection); if (ret != S_OK) { - GST_ERROR_OBJECT (self, "Failed to get attribute (autodetection)"); + GST_ERROR_OBJECT (self, + "Failed to get attribute (autodetection): 0x%08x", ret); return FALSE; } if (autoDetection) @@ -389,7 +391,7 @@ gst_decklink_video_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) format = self->caps_format; ret = self->input->input->EnableVideoInput (mode->mode, format, flags); if (ret != S_OK) { - GST_WARNING_OBJECT (self, "Failed to enable video input"); + GST_WARNING_OBJECT (self, "Failed to enable video input: 0x%08x", ret); return FALSE; }