After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739284 - decklinksrc: add automatic mode detection and timeout property
decklinksrc: add automatic mode detection and timeout property
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2014-10-28 10:05 UTC by chamois94
Modified: 2015-01-08 17:16 UTC
See Also:
GNOME target: ---
GNOME version: ---

input connection property (6.63 KB, patch)
2015-01-06 16:48 UTC, chamois94
committed Details | Review
automatic mode detection (9.03 KB, patch)
2015-01-06 16:49 UTC, chamois94
needs-work Details | Review

Description chamois94 2014-10-28 10:05:14 UTC
Add automatic mode detection when available

Timeout property to emit EOS
Comment 1 Sebastian Dröge (slomo) 2014-11-11 10:03:06 UTC
Would be good to split these patches a bit into functionally independent things (like the EOS handling and the mode detection separately), and then attach them here for review.
Comment 2 Sebastian Dröge (slomo) 2014-12-16 19:45:28 UTC
I'm implementing something like this mode detection in my decklink rewrite. No need to update this patch for now :)
Comment 3 Sebastian Dröge (slomo) 2014-12-19 14:01:44 UTC
Actually not because I can't test the mode detection code here as it doesn't seem to work.

Would be great if you could update your patch to latest GIT master, and attach the patches here.
Comment 4 chamois94 2015-01-06 16:48:17 UTC
Created attachment 293952 [details] [review]
input connection property
Comment 5 chamois94 2015-01-06 16:49:29 UTC
Created attachment 293953 [details] [review]
automatic mode detection

Sorry for the late answer. I updated my work to the latest GIT and added input connection property. Why did you remove this one ?

Thanks for review
Comment 6 chamois94 2015-01-06 17:39:15 UTC
You can also use my gitorious :
Comment 7 Sebastian Dröge (slomo) 2015-01-08 11:53:12 UTC
Comment on attachment 293952 [details] [review]
input connection property

commit ed0d4cc65378f5f64d05fdce2af679f62c6aace5
Author: Sebastian Dröge <>
Date:   Thu Jan 8 12:48:22 2015 +0100

    decklinkaudiosrc: Add property to select the audio input connection

commit 34de6ad73b6f725ff818b1845d8faa7adcf143db
Author: Sebastian Dröge <>
Date:   Thu Jan 8 12:23:53 2015 +0100

    decklink: Add XLR and RCA audio connection enums

commit a35d5ae9b965c0aa98c021d0fdf32746f1d1f938
Author: Sebastian Dröge <>
Date:   Thu Jan 8 12:17:45 2015 +0100

    decklinkvideosrc: Add auto value for the connection property
    This will use the default/auto connection for video capturing, and can
    be set via the Decklink configuration tools.

commit 478deb48058b226de53ab555db5187f9680a9020
Author: Sebastian Dröge <>
Date:   Thu Jan 8 12:13:03 2015 +0100

    decklink: Fix indention once again

commit 81c1ef190d1abc5ac122ecfa1063f4af4747190e
Author: Florian Langlois <>
Date:   Tue Jan 6 14:02:38 2015 +0100

    decklink: Add property for configuring the input connection of the video sources
Comment 8 Sebastian Dröge (slomo) 2015-01-08 12:03:47 UTC
Review of attachment 293953 [details] [review]:

::: sys/decklink/gstdecklink.cpp
@@ +193,3 @@
+  switch(mode) {
+    case bmdModeNTSC:
+      displayMode = GST_DECKLINK_MODE_NTSC;

This could also become a table like for the connections:


@@ +283,3 @@
+      break;
+    default:
+      break;

default case should do a g_assert_not_reached()

@@ +452,3 @@
+    g_mutex_lock (&m_input->lock);
+    src = GST_DECKLINK_VIDEO_SRC_CAST(m_input->videosrc);

This should be done via a callback that is defined in gstdecklinkvideosrc.cpp

@@ +457,3 @@
+    m_input->input->FlushStreams();
+    m_input->input->EnableVideoInput (mode->GetDisplayMode(),

Isn't it necessary to first DisableVideoInput()?

@@ +463,3 @@
+    gst_video_info_from_caps (&src->info, caps);
+    gst_base_src_set_caps(GST_BASE_SRC_CAST(m_input->videosrc), caps);
+    gst_caps_unref (caps);

To make this work in a threadsafe way you would need to store the caps together with the buffers and their timestamps inside the queue, and then inside create() set new caps if they have changed

Otherwise the queue might still contain buffers with old caps after you set the new caps. And you must only set the caps from the streaming thread (i.e. from create()).

::: sys/decklink/gstdecklink.h
@@ +84,3 @@

Why is UNKNOWN needed? Ideally you would give it the value -1 or something like that so we can easily extend this enum here later

::: sys/decklink/gstdecklinkvideosrc.cpp
@@ +448,3 @@
+  flags = bmdVideoInputFlagDefault;
+  if (self->mode == GST_DECKLINK_MODE_AUTO || self->mode == GST_DECKLINK_MODE_UNKNOWN) {

When would it ever be UNKNOWN?
Comment 9 chamois94 2015-01-08 16:57:34 UTC
Hello, thanks for reviewing. Some answers. And fixes into my git :

1/ Seems difficult to construct a table because bmd enums are not monotonic. Am I wrong ?

2/ Added g_assert_not_reached in default case

3/ Changed the way I set the caps. Should be threadsafe now.

4/ Following the SDK the good way is to Pause, Flush, EnableVideo then Start. So seems good. And works for me.


Maybe now it can be pushed.
Comment 10 Sebastian Dröge (slomo) 2015-01-08 17:16:56 UTC
Merged, thanks! :) Some minor changes on top of it though.

Let me know if there's anything else that is not optimal yet

commit 4531a341a8490f8e5277c1dac1e2e5cf98c71b64
Author: Sebastian Dröge <>
Date:   Thu Jan 8 18:15:27 2015 +0100

    decklinkvideosrc: Post LATENCY message when the mode changes
    Different modes have different framerates, and thus different latencies. We
    might need to reconfigure the latency of the pipeline.

commit beede3f27de5d9810b9c87a6f1ea69feabac63a9
Author: Sebastian Dröge <>
Date:   Thu Jan 8 18:14:38 2015 +0100

    decklinkvideosrc: Fix compiler warning

commit 9480d91ad41bdeb836a45a415e911fb870dc0955
Author: Florian Langlois <>
Date:   Thu Jan 8 16:42:31 2015 +0100

    decklinkvideosrc: Add automatic mode detection