Commit graph

58 commits

Author SHA1 Message Date
Nirbheek Chauhan
2fac6fa6a6 decklink: Fix format specifier warnings in logging
gstdecklinkvideosrc.cpp:425:7: warning: format '%x' expects argument of type 'unsigned int', but argument 8 has type 'HRESULT {aka long int}' [-Wformat]

[and so on]
2017-07-19 02:27:48 +05:30
Sebastian Dröge
f0b1b97b25 decklink: Make timestamp reference specifier driver specific 2017-06-07 17:50:09 +03:00
Sebastian Dröge
5dc1039937 decklinkvideo/audiosrc: Add GstReferenceTimestampMeta with the stream time to each buffer
This is basically a frame counter provided by the driver and it's
advancing at the speed of the HDMI/SDI input. Having this available on
each buffer allows to know what constant-framerate-based timestamp each
frame is corresponding to and can be used e.g. to write out files
accordingly without having the local pipeline clock timestamps used.

https://bugzilla.gnome.org/show_bug.cgi?id=779213
2017-05-12 11:42:00 +02: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
0a4717ea20 Revert "decklinkvideo/audiosrc: Add GstReferenceTimestampMeta with the stream time to each buffer"
This reverts commit d5684d5b14.

This shouldn't have been merged before 1.12.
2017-04-19 19:08:41 +01:00
Sebastian Dröge
d5684d5b14 decklinkvideo/audiosrc: Add GstReferenceTimestampMeta with the stream time to each buffer
This is basically a frame counter provided by the driver and it's
advancing at the speed of the HDMI/SDI input. Having this available on
each buffer allows to know what constant-framerate-based timestamp each
frame is corresponding to and can be used e.g. to write out files
accordingly without having the local pipeline clock timestamps used.

https://bugzilla.gnome.org/show_bug.cgi?id=779213
2017-04-19 19:06:37 +01:00
Sebastian Dröge
d53da45886 decklink: Use GstQueueArray instead of GQueue
Let's save two allocations and frees per frame.
2017-03-24 14:26:39 +02:00
Georg Lippitsch
7ee593e493 decklinkvideosrc: Add read-only "signal" property
https://bugzilla.gnome.org/show_bug.cgi?id=780367
2017-03-22 15:17:30 +02:00
Sebastian Dröge
4cdd234add decklink: Fix indentation 2017-01-31 14:56:34 +02:00
Vivia Nikolaidou
3cb43f35b8 decklinkvideosrc: Do not append a zero timecode if none is found on the source
If the source doesn't give us timecode information, do not append a zero
timecode to the frames.

https://bugzilla.gnome.org/show_bug.cgi?id=776900
2017-01-09 18:37:50 +02:00
Sebastian Dröge
e31714691a decklink: Fix indentation 2017-01-03 17:31:03 +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
aec46143bb decklinksrc: Add property to drop frames that are marked as having no input signal
https://bugzilla.gnome.org/show_bug.cgi?id=774850
2016-11-28 14:27:51 +02:00
Sebastian Dröge
331b2af050 decklinksrc: Add property to skip the first N seconds of capture
On some hardware the first few frames are bogus and not very useful.
Their timestamps are off, they have no timecodes, or there are spurious
black frames / no-signal frames. After a few frames this stabilizes
though.

https://bugzilla.gnome.org/show_bug.cgi?id=774850
2016-11-28 14:27:51 +02:00
Sebastian Dröge
cf224a9990 decklinksrc: Set GAP flag on buffers that are captured without signal
https://bugzilla.gnome.org/show_bug.cgi?id=774850
2016-11-28 14:27:51 +02:00
Sebastian Dröge
09dd64bb4f decklinksrc: Keep track of a window of capture/stream time mappings and calculate relationship
Based on this we calculate the actual capture time, which should get us
rid of any capturing jitter by averaging it out.

Also add a output-stream-time property which forces the elements to
output the stream time directly instead of doing any conversion to the
pipeline clock. Use with care.

https://bugzilla.gnome.org/show_bug.cgi?id=774850
2016-11-28 14:27:51 +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
2a66653bdc decklinkvideosrc: Free timecodes when done with a frame 2016-11-24 14:48:52 +02:00
Vivia Nikolaidou
85ef4166a2 decklinkvideosrc: Issue "no signal" warnings
When a frame is found to not have an associated input source (cable
unplugged, wrong mode selected), an element warning will be issued. When
the next frame in the stream is found to have an input source selected
(e.g. cable replugged), an element info will be issued.

https://bugzilla.gnome.org/show_bug.cgi?id=774629
2016-11-17 18:40: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
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
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
Vivia Nikolaidou
8faa36e105 decklinkvideosrc: Add support for GstVideoTimeCode
The timecode will be fetched from the decklink source and attached to the
video buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=766419
2016-08-04 19:08:27 +03:00
Edward Hervey
41283361fa decklinkvideosrc: Fix previous commit
The frames queue might return nothing (be empty) if we're flushing.

Move the assertion to after the flushing check
2016-05-11 16:52:44 +02:00
Tim-Philipp Müller
ddcc1c6442 decklinkvideosrc: fix use-after-free in error code path 2016-05-10 09:40:38 +01:00
Tim-Philipp Müller
8d128f8bf5 decklinkvideosrc: remove unnecessary checks for non-NULL frame
We can't get a NULL frame here.

CID 1359923
2016-05-10 09:38:28 +01: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
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
Josep Torra
cf66541850 decklinkvideosrc: fix mode autodetection
The autodetection mode was broken because a race condition in the input mode
setting. The mode could be reverted back when it was replaced in
the streaming thread by the old mode in the middle of mode changed callback.
2015-04-22 17:20:22 +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
8e362aab14 decklink{audio,video}src: Add some more debug output 2015-03-02 13:57:24 +01:00
Sebastian Dröge
72b440cc89 decklinkvideosrc: Fix scaling with rate of internal/external clock 2015-02-27 11:08:14 +02:00
Sebastian Dröge
9ed4054a94 decklinkvideosrc: Apply the diff between element and pipeline "base" time in all cases
Even if both clocks have the same rate, we need to apply this diff. Only when
it's the same clock we don't, as it's our clock then.
2015-02-10 16:01:19 +01:00
Sebastian Dröge
f83ac624e3 decklinkvideosrc: Add the diff between the pipeline base time and when we start to play
Add the diff between the external time when we went to playing and
the external time when the pipeline went to playing. Otherwise we
will always start outputting from 0 instead of the current running
time.
2015-02-10 15:30:44 +01:00
Sebastian Dröge
e8167dd118 decklinkvideo{src,sink}: Sample the internal clock immediately after starting the device
Otherwise we might stay at 0.0s for too long because we will take the first
timestamp we ever see as 0.0... which will be after we started the device.
2015-02-10 14:48:09 +01:00
Sebastian Dröge
f0e85023c2 decklink{audio,video}src: Implement clock slaving if the pipeline clock is not the decklink clock 2015-02-09 17:17:37 +01:00
Sebastian Dröge
22b0a4dad5 decklink{audio,video}src: Take the capture times from the pipeline clock
Not from the decklink clock. Both will return exactly the same time once the
decklink clock got slaved to the pipeline clock and received the first
observation, but until then it will return bogus values. But as both return
exactly the same values, we can as well use the pipeline clock directly.
2015-02-08 21:56:04 +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
e2ff5587fe decklink{audio,video}src: Only start the streams once both sources are ready and we are in PLAYING
Otherwise we might start the streams 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
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
f3ae93e504 decklinkvideosrc: Properly report caps if mode!=auto and handle caps changes properly for mode=auto 2015-01-28 16:13:16 +01:00
Sebastian Dröge
4531a341a8 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.
2015-01-08 18:16:12 +01:00
Sebastian Dröge
beede3f27d decklinkvideosrc: Fix compiler warning 2015-01-08 18:16:12 +01:00
Florian Langlois
9480d91ad4 decklinkvideosrc: Add automatic mode detection
https://bugzilla.gnome.org/show_bug.cgi?id=739284
2015-01-08 18:16:12 +01:00
Sebastian Dröge
a35d5ae9b9 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.
2015-01-08 12:23:09 +01:00