Commit graph

56 commits

Author SHA1 Message Date
Sebastian Dröge
011649790d decklinkvideosink: Only start if both sinks are set to PLAYING already
Not only if the video sink is set to PLAYING so far. Also give more
useful debug output about why we don't start, and don't start if already
started.

Also refactor the function to early-return instead of having a huge
if-else block over the whole function.

https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-14 10:37:20 +02:00
Sebastian Dröge
86888d9918 decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink
The Decklink and GstAudioBaseSink APIs don't fit very well together,
which causes various problems due to inaccuracies in the clock
calculations and the actual ringbuffer and GStreamer's copy getting of
sync.

Problems are audio drop-outs and A/V sync getting wrong after
pausing/seeking.

https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-14 10:37:20 +02:00
Sebastian Dröge
02e4d92cbf decklinkvideosink: Wait until scheduled playback is actually stopped before continuing
Otherwise we might "start" again, just to get finally stopped and then
getting errors all over the place.

https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-06 19:38:55 +02:00
Sebastian Dröge
e2c8afa261 decklinkvideosink: Print "Starting" instead of "Stopping" when starting 2017-11-22 17:22:03 +02:00
Sebastian Dröge
a563cbbc1c decklink: Add read-only property to read the device serial number
https://bugzilla.gnome.org/show_bug.cgi?id=788510
2017-10-18 12:33:28 +02:00
Dave Johnstone
0cd1bf13e8 decklinkvideosink: Add support for Decklink hardware keying
Add two properties (keyer-mode and keyer-level) to control the built-in hardware keyer of Decklink cards.

https://bugzilla.gnome.org/show_bug.cgi?id=773660
2017-08-15 11:09:37 +03:00
Sebastian Dröge
571c8bc1ff decklink: Fix indentation 2017-08-02 19:07:35 +03:00
Nirbheek Chauhan
ca8c63080f decklink: Fix format specifier warnings in logging v2
HRESULT is unsigned long on Windows, but the Decklink headers define
it to 'int' on Linux. Confusingly, the defines that talk about the
possible return values for it use long constants. The easy fix would
be to change the linux/LinuxCOM.h header, but that's copied from the
decklink SDK.

Change the logging to always upcast to unsigned long while printing
HRESULT for consistency across platforms.
2017-07-19 04:19:34 +05:30
Nirbheek Chauhan
0084bfccc9 decklink: Fix build on mingw32 by adding missing WINAPI
gstdecklinkaudiosink.cpp:155:19: error: conflicting type attributes specified for 'virtual HRESULT GStreamerAudioOutputCallback::QueryInterface(const IID&, void**)'
In file included from /var/lib/jenkins/workspace/cerbero-cross-mingw32/workdir/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include/objbase.h:153:0,
                 from /var/lib/jenkins/workspace/cerbero-cross-mingw32/workdir/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include/ole2.h:16,
                 from /var/lib/jenkins/workspace/cerbero-cross-mingw32/workdir/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include/windows.h:94,
                 from /var/lib/jenkins/workspace/cerbero-cross-mingw32/workdir/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include/rpc.h:16,
                 from win/DeckLinkAPI.h:27,
                 from gstdecklink.h:35,
                 from gstdecklinkaudiosink.h:27,
                 from gstdecklinkaudiosink.cpp:25:
/var/lib/jenkins/workspace/cerbero-cross-mingw32/workdir/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include/unknwn.h:67:25: error:   overriding 'virtual HRESULT IUnknown::QueryInterface(const IID&, void**)'

(and many more)

https://ci.gstreamer.net/job/cerbero-cross-mingw32/6407/console
2017-07-19 02:27:29 +05:30
Sebastian Dröge
7d64bb7513 decklinkvideosink: Copy min(gstreamer_stride, decklink_stride) per line
Instead of just bpp * width, which might be more than we can copy.
2017-05-15 16:38:51 +03:00
Nirbheek Chauhan
b63fb59a11 Revert "decklink: Fix debug logging warnings on Windows"
This reverts commit 845832263b.

The commit broke cross-mingw CI:
https://ci.gstreamer.net/job/GStreamer-master/8659/console

It seems that cross-mingw on Autotools and native-mingw on Meson
disagree about the size of HRESULT. Revert for now till I can
investigate the Meson side of things some more.
2017-05-05 18:52:24 +05:30
Nirbheek Chauhan
845832263b decklink: Fix debug logging warnings on Windows
HRESULT is unsigned long int, not unsigned int
2017-05-05 17:49:22 +05:30
Sebastian Dröge
ce4df5311b decklinkvideosink: Don't error out if displaying the preroll frame fails
This seems to happen sometimes on some hardware, and is not really
critical as long as the scheduling of the normal frames works fine.

Only post a warning message for this case.
2017-03-01 12:08:58 +02:00
Sebastian Dröge
2ab19144be decklinkvideosink: Show video frames synchronously in PAUSED
Otherwise we will only show the preroll frame once PLAYING is reached,
which is rather suboptimal for e.g. seeking in PAUSED.
2017-02-01 17:11:37 +02:00
Sebastian Dröge
8d723c5fe1 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.
2017-02-01 16:45:53 +02:00
Sebastian Dröge
fdf1a57953 decklink: Correctly set top-field-first/bottom-field-first
First of all, all the HD and UHD modes should be top-field-first, as
also returned by the Decklink mode iterator API.

Then we should include the caps field "field-order" in the caps of the
source (not the sink due to negotiation problems with optional fields).

And finally we should set the TFF flag on interlaced buffers that are
top-field-first.
2016-11-28 17:19:26 +02:00
Sebastian Dröge
881a08671e decklinksrc: Stop using the "hardware" timestamps and directly use the pipeline clock
The hardware timestamps have no relation to when frames were produced,
only when frames arrived somewhere in the hardware. Especially there is
no guarantee that audio and video will have the same hardware timestamps
although they belong together, and even more important: the rate with
which the hardware timestamps increase is completely unrelated to the
rate with which the frames are captured!

As such we can as well use the pipeline clock directly and stop doing
complicated calculations. Also as a side effect this allows now running
without any pipeline clock, by directly making use of the stream times
as reported by the driver.

https://bugzilla.gnome.org/show_bug.cgi?id=774850
2016-11-28 14:27:51 +02:00
Sebastian Dröge
33a93a66c8 decklinkvideosink: Also stop scheduled playback when gst_element_lost_state() is called
Unfortunately this does not go through the normal state change
machinery, so we don't get notified about this in change_state().
However we need to stop scheduled playback, so that once PLAYING is
reached again we can start scheduled playback with the correct time.

Without this, flushing seeks in PLAYING will not work correctly:
decklinkvideosink will wait before showing the new frames for the amount
of time the pipeline was in PLAYING before.
2016-11-02 16:12:42 +02:00
Sebastian Dröge
ac37bdb9ac decklink: Use gst_clock_adjust_with_calibration() and unadjust_with_calibration()
Instead of hand-crafted versions of the same calculation. These
calculations are still too complicated though.
2016-11-02 15:00:36 +02:00
Sebastian Dröge
f9a8b843df decklink: Print the Decklink API error return values in debug output in all places 2016-09-21 09:31:41 -04:00
Sebastian Dröge
95eb492c32 Revert "decklinkvideosink: Scale down scheduled frame times to milliseconds"
This reverts commit 3b7e0d7de3.

It was a bug in the driver and is supposed to be fixed with 10.8 and newer.
2016-09-12 12:20:01 +02:00
Sebastian Dröge
fcea134ec4 decklink: Fix-up last commit that was not meant to be pushed yet 2016-09-01 14:25:58 +03:00
Sebastian Dröge
8be08ee7fd decklink: Fix indentation 2016-09-01 14:18:33 +03:00
Sebastian Dröge
d8327b397d decklink: Require a clock when going from PAUSED_TO_PLAYING and don't crash if there is none
Also when going from PLAYING_TO_PAUSED, the clock might've been unset in the
meantime, e.g. because the element was removed from its surrounding bin.
2016-09-01 14:17:48 +03:00
Sebastian Dröge
3b7e0d7de3 decklinkvideosink: Scale down scheduled frame times to milliseconds
Scale down to milliseconds, otherwise at least some hardware has problems
scheduling the frames (or schedules them too slow) and we run out of available
frames.

https://bugzilla.gnome.org/show_bug.cgi?id=770282
2016-08-26 15:49:40 +03:00
Vivia Nikolaidou
de1f42a284 decklinkvideosink: Add support for GstVideoTimeCode
The timecode will be fetched from the video buffer and outputted on the
decklink video sink.

https://bugzilla.gnome.org/show_bug.cgi?id=766419
2016-08-04 19:08:27 +03:00
Vivia Nikolaidou
832764d2fd decklink: Add initial 10bit support for YUV modes
https://bugzilla.gnome.org/show_bug.cgi?id=742878
2016-05-03 15:57:23 +03:00
Julien Moutte
3ea431c5b5 decklinkvideosrc: implement RGB capture support
Combine mode and format to generate caps and support the flags from VideoChanged callback to support RGB capture.

https://bugzilla.gnome.org/show_bug.cgi?id=760594
2016-01-22 16:11:08 +01:00
Vivia Nikolaidou
fafc8e564c decklinkvideosink: Made "auto" mode work according to caps
When the mode of decklinkvideosink is set to "auto", the sink claims to
support the full set of caps that it can support for all modes. Then, every
time new caps are set, the sink will automatically find the correct mode for
these caps and set it.

Caveat: We have no way to know whether a specific mode will actually work for
your hardware. Therefore, if you try sending 4K video to a 1080 screen, it
will silently fail, we have no way to know that in advance. Manually setting
that mode at least gave the user a way to double-check what they are doing.

https://bugzilla.gnome.org/show_bug.cgi?id=759600
2015-12-18 16:08:02 +01:00
Sebastian Dröge
9764e22a5c decklink: Add a clock epoch that is used as offset whenever restarting the clock
Otherwise we're going to return times starting at 0 again after shutting down
an element for a specific input/output and then using it again later.

https://bugzilla.gnome.org/show_bug.cgi?id=755426
2015-09-24 09:32:36 +02:00
Sebastian Dröge
e0fd5317df decklink: Disable inputs/outputs in PAUSED->READY to allow going to PAUSED again from there
https://bugzilla.gnome.org/show_bug.cgi?id=755426
2015-09-24 09:32:27 +02:00
Sebastian Dröge
b2149e7bb4 decklinkvideosink: less-than-zero comparison of an unsigned value is never true
Use the correct type, GstClockTimeDiff, instead.

CID 1323742
2015-09-10 14:11:58 +03:00
Sebastian Dröge
b6498c32f3 decklinkvideosink: Handle pipelines where the running time does not start around 0 properly
We were converting all times to our internal running times, that is the time
the sink itself spent in PLAYING already. But forgot to do that for the
running time calculated from the buffer timestamps. As such, all buffers were
scheduled much later if the pipeline's running time did not start at 0.

This happens for example if a base time is explicitly set on the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=754528
2015-09-09 16:59:02 +03:00
Sebastian Dröge
a6744a915b decklinkvideosink: Consider pipeline latency, render delay and ts offset when scheduling frames
Without this, we will schedule all frames too late in live pipelines.

https://bugzilla.gnome.org/show_bug.cgi?id=754666
2015-09-09 16:58:45 +03:00
Sebastian Dröge
e3aaff400a decklinkvideosink: Remove late frame-dropping workaround for basesink bug
This was fixed by https://bugzilla.gnome.org/show_bug.cgi?id=749258
in basesink, and is not necessary to duplicate here anymore.
2015-06-13 11:41:33 +02:00
Sebastian Dröge
62f25894a5 decklinkvideosink: Don't require the same framerate in the input as the mode's framerate
We only really care about the timestamps for the sink.
2015-06-12 22:35:03 +02:00
Sebastian Dröge
4521524de3 decklink: Reset the clock calibration when unsetting the master clock
Otherwise the old calibration will stick around for the next time we use it,
potentially giving us completely wrong times.
2015-03-02 16:45:45 +01:00
Sebastian Dröge
d4575e759b decklinkvideosink: Actually include the change mentioned in the last commit 2015-02-10 14:53:55 +01:00
Sebastian Dröge
e9b49018ed decklinkvideosink: Always lock the mutex before starting the streams 2015-01-28 17:02:59 +01:00
Sebastian Dröge
837eee7085 decklinkvideosink: Fix deadlock 2015-01-28 16:59:30 +01:00
Sebastian Dröge
4eb5cd9156 decklink{audio,video}sink: Only start scheduled playback once both sources are ready and we are in PLAYING
Otherwise we might start the scheduled playback before the audio or video streams are
actually enabled, and then error out later because they are enabled to late.

We enable the streams when getting the caps, which might be *after* we were
set to PLAYING state.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
00176a1ddf decklink: Make sure our clock never returns NONE, always advances and does not jump when going from PAUSED to PLAYING
It basically behaves the same as the audio clocks.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
b3a4772834 decklinkvideosink: Handle the clock returning GST_CLOCK_TIME_NONE properly 2015-01-28 16:13:16 +01:00
Sebastian Dröge
8a5d2c561c decklinkvideo{sink,src}: Make elements more similar to the audio elements by enabling the video input/output only when getting the actual caps
This will also make it easier later to support caps changes and support
selecting the mode based on the caps if that should ever be implemented.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
e734c3cf13 decklinkvideosink: Also consider max-lateness property value before dropping late frames 2015-01-15 12:49:46 +01:00
Sebastian Dröge
5a12b2670e decklinkvideosink: Stop scheduled playback shortly in PAUSED->PLAYING if it was running already
This fixes handling of flushing seeks, where we will get a PAUSED->PLAYING
state transition after the previous one without actually going to PAUSED
first.
2015-01-14 16:33:53 +01:00
Sebastian Dröge
92fa187d11 decklinkvideosink: Don't schedule too late frames in prepare()
Otherwise we will overflow the internal buffer of the hardware
with useless frames and run into an error. This is necessary until
this bug in basesink is fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=742916
2015-01-14 16:02:57 +01:00
Sebastian Dröge
7b979703f8 decklinkvideosink: Keep track of the time when we went to PLAYING for the external clock too
Otherwise we're adding an offset of the time the pipeline was in PLAYING
already to the running time when converting it to our internal clock.
2015-01-14 16:00:54 +01:00
Sebastian Dröge
aed66838f3 decklinkvideosink: Enable QoS and set max-lateness to 20ms 2015-01-14 13:33:15 +01:00
Sebastian Dröge
65119ae8b4 decklink: Fix indention once again 2015-01-13 19:56:45 +01:00