Commit graph

57 commits

Author SHA1 Message Date
Vivia Nikolaidou 6af863916a decklinkaudiosrc: Extrapolate stream/hw reference timestamps when video frame is missing
Sometimes we might get an audio packet without a corresponding video
frame. In these cases, the stream and hardware reference timestamps
would be missing, because they're called on the video frame. Instead of
potentially breaking stuff downstream that might depend on these, we now
extrapolate them.

https://bugzilla.gnome.org/show_bug.cgi?id=792042
2018-01-04 13:54:37 +02:00
Vivia Nikolaidou 8dceeb5ccd WIP: Revert "Revert "decklink: Detect gaps on incoming stream times, issue warnings""
This reverts commit 07819afda4.
2018-01-04 13:54:37 +02:00
Vivia Nikolaidou 07819afda4 Revert "decklink: Detect gaps on incoming stream times, issue warnings"
This reverts commit c1294e10f9.

Was not ready to be pushed yet.
2017-11-07 21:12:42 +02:00
Vivia Nikolaidou c1294e10f9 decklink: Detect gaps on incoming stream times, issue warnings
When we receive a video or audio buffer, we calculate the next stream
time based on the current stream time + buffer duration. If the next
buffer's stream time is after that, we issue a warning.

This happens because the stream time incoming from Decklink should be
really constant and without gaps. If there is a gap, it means that
something went wrong, e.g. the internal buffer pool is empty (too many
buffers queued up downstream).

https://bugzilla.gnome.org/show_bug.cgi?id=781776
2017-11-07 16:45:52 +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
Vivia Nikolaidou 0355bb7c34 decklink: Print one "dropped N old frames" message, not one per frame
If we drop many frames at once, printing one message per video frame and
one per audio packet would cause a lot of disk IO. Just print a total at
the end.

https://bugzilla.gnome.org/show_bug.cgi?id=788780
2017-10-11 19:29:26 +03:00
Sebastian Dröge 350c56dab4 decklinkaudio/videosrc: Put hardware reference timestamp in a reference timestamp meta
This can be useful to know on multi-channel cards which frames from
different channels were captured at the same time.
2017-09-28 13:55:18 +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
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
Sebastian Dröge 4df6be45f0 decklinkaudiosrc: Consistently pass stream_time and stream_duration to audio/video src
It's the same value now, pass it consistently.
2017-05-12 11:36:27 +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
Vivia Nikolaidou 21a9a89851 decklinkaudiosrc: Fix get_caps returning EMPTY
If get_caps is called before negotiation, channels_found will be 0 and
therefore won't intersect with the template caps.

https://bugzilla.gnome.org/show_bug.cgi?id=778028
2017-02-01 15:17:33 +02:00
Sebastian Dröge 81b20f15fc decklinkaudiosrc: Fix compilation on OSX
15:18:47 gstdecklinkaudiosrc.cpp:745:45: error: cannot initialize a parameter of type 'int64_t *' (aka 'long long *') with an rvalue of type 'gint64 *' (aka 'long *')
15:18:47           (BMDDeckLinkMaximumAudioChannels, &self->channels_found);
15:18:47                                             ^~~~~~~~~~~~~~~~~~~~~
15:18:47 ./linux/DeckLinkAPI.h:970:87: note: passing argument to parameter 'value' here
15:18:47     virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0;
15:18:47                                                                                       ^
2017-01-27 17:24:20 +02:00
Vivia Nikolaidou f23277e55d decklinkaudiosrc: Option to use max channels supported by device
Query the device for the maximum number of channels supported and have
an option to use that. Default is still 2.

https://bugzilla.gnome.org/show_bug.cgi?id=777458
2017-01-26 16:18:57 +02:00
Sebastian Dröge e8e531ee12 decklinkaudiosrc: Add support for 8/16 channels via property
These are unpositioned channel layouts.
2017-01-03 17:30:07 +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
Vivia Nikolaidou ab991db7ed decklinkaudiosrc: Ignore channel-mask when checking set_caps compatibility
channel-mask doesn't matter in decklinkaudiosrc, and differences in it
can cause caps negotiations to fail without a real reason.

https://bugzilla.gnome.org/show_bug.cgi?id=773313
2016-11-01 19:39: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 87503ac174 decklink: Fix indentation 2016-05-03 15:57:23 +03:00
Sebastian Dröge f06647fd0c decklinkaudiosrc: Don't accept packets without timestamps after a discont
We have no idea which timestamps they are supposed to have so the only thing
we can do at this point is to drop them. Packets without timestamps happen if
audio was captured but no corresponding video, which shouldn't happen under
normal circumstances.

https://bugzilla.gnome.org/show_bug.cgi?id=747633
2016-04-05 14:49:51 +03:00
Sebastian Dröge 0004920c83 decklinkaudiosrc: Don't crash when receiving video frames but no audio
And mark these events as disconts to reset time tracking in the audio source.

https://bugzilla.gnome.org/show_bug.cgi?id=747633
2016-04-05 14:47:00 +03:00
Vineeth TM 8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Jan Schmidt 0d3cd82749 decklinkaudiosrc: Fix discont tracking
Don't reset the marker that's tracking disconts until
either the discont disappears or we resync.
2016-02-04 14:33:09 +11: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 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 254337365a decklinkaudiosrc: Calculate the duration more accurately from the capture time and numbers of samples
This should prevent any accumulating rounding errors with the duration.
2015-03-04 16:13:30 +01:00
Sebastian Dröge 912e58c64c decklinkaudiosrc: Fix the timestamp and offset calculations even more 2015-03-04 16:07:10 +01:00
Sebastian Dröge 1f9d37c924 decklinkaudiosrc: Don't subtract the duration from the capture time
We already have the real capture time, not the time when we received
the end of the packet.
2015-03-04 16:04:18 +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 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 408f0870a6 decklinkaudio{src,sink}: Only start streams / scheduled playback if there is a videosrc at this point 2015-02-09 17:15:21 +01:00
Sebastian Dröge 349113d15a decklinkaudiosrc: Don't provide a clock
The audio source only works together with the video source, and the video
source is already providing a clock.
2015-02-09 17:04:27 +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 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 7fb57938c1 decklinkaudiosrc: Don't release input device twice on errors in set_caps() 2015-01-28 16:13:16 +01:00
Sebastian Dröge c6d5c4c2e1 decklinkaudiosrc: Release the audio input on errors, not the video input 2015-01-26 15:33:45 +01:00
Sebastian Dröge ed0d4cc653 decklinkaudiosrc: Add property to select the audio input connection 2015-01-08 12:48:22 +01:00
Sebastian Dröge 478deb4805 decklink: Fix indention once again 2015-01-08 12:13:03 +01:00
Florian Langlois e7c6eb6326 decklink: Fix latency values for sources 2015-01-07 16:42:57 +01:00
Sebastian Dröge d632a48d6c decklink: Fix various compiler warnings with gcc 2014-12-19 15:05:58 +01:00