Commit graph

280 commits

Author SHA1 Message Date
Vivia Nikolaidou
42a03a8124 Revert "WIP: Revert "Revert "decklink: Detect gaps on incoming stream times, issue warnings"""
This reverts commit 8dceeb5ccd.
2018-01-04 15:41:51 +02:00
Vivia Nikolaidou
8ee1534b80 Revert "decklinkaudiosrc: Extrapolate stream/hw reference timestamps when video frame is missing"
This reverts commit 6af863916a.
2018-01-04 15:41:44 +02:00
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
Sebastian Dröge
2b8f82f929 decklinkaudiosink: Start audio pre-rolling if the output is not started yet in render()
This seems to allow to schedule audio samples correctly at their right
times already.

https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-14 10:37:20 +02:00
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
a38cf7d8a9 decklinkaudiosink: Include final flow return in debug output
https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-14 10:37:20 +02:00
Sebastian Dröge
3e70f00209 decklinkaudiosink: Check also against the clock if we run ahead of the clock too much
The buffer level as reported by the Decklink driver is completely
unreliable, and we could otherwise easily run ahead >1s if we're
unlucky.

https://bugzilla.gnome.org/show_bug.cgi?id=790114
2017-12-14 10:37:20 +02:00
Sebastian Dröge
118b2967e7 decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
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
Vivia Nikolaidou
71bfbce84d decklink: Remove unused "bflags" variable
We are ignoring all its flags anyway, so let's remove it altogether.
2017-11-09 12:08:35 +02:00
Vivia Nikolaidou
5ab660c4e2 decklink: Ignore some driver-set timecode flags
The "fields" flag is ignored because currently GStreamer doesn't support
having only top or only bottom fields inside a frame. The "drop frame"
flag is ignored because some occurrences have been spotted where it
wasn't set while it should have been. In practice, when we have 29.97 or
59.94 FPS, it's always drop-frame.

https://bugzilla.gnome.org/show_bug.cgi?id=790112
2017-11-09 11:55:13 +02:00
Vivia Nikolaidou
bae9427dc1 decklink: Don't crash when getting hw serial number doesn't return OK
If the return value isn't OK, it means we might be getting data that
points to an invalid memory address. That shouldn't make us crash.
2017-11-09 00:19:42 +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
Sebastian Dröge
980ddfdfb7 decklink: Free the correct memory in our own buffer pool
The buffer itself is 128 bytes into the allocated memory area, to be
able to store the size and other metadata before it. Freeing the buffer
directly will make malloc moderately unhappy.
2017-09-21 14:40:06 +03: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
Georg Lippitsch
a205338082 decklinksrc: Raise limit of devices to 16
https://bugzilla.gnome.org/show_bug.cgi?id=785694
2017-08-01 10:22:58 -04:00
Nirbheek Chauhan
a163dff91d decklink: Fix building with MSYS2's MinGW
Reported and tested by Philippe Renon.

https://bugzilla.gnome.org/show_bug.cgi?id=784943
2017-07-20 19:18:28 +05:30
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
3fd4249a1d decklink: Fix CI failure due to missing WINAPI definition
WINAPI is for the windows calling convention to use, and should expand
to nothing on Linux.

https://build.gnome.org/continuous/buildmaster/builds/2017/07/18/76/build/log-gst-plugins-bad.txt
2017-07-19 04:14:13 +05:30
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
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
Nirbheek Chauhan
528ae2c15d decklink: Add autotools support on Windows
Also add a missing windows file to EXTRA_DIST

https://bugzilla.gnome.org/show_bug.cgi?id=784943
2017-07-14 17:21:13 +05:30
Georg Lippitsch
f0c7fbb371 decklinkvideosrc: Add custom memory allocator
The default memory allocator of the decklink library allocates
a fixed pool of buffers, and the number of buffers is unknown.
This makes it impossible do useful queuing downstream. The new
memory allocator can create an unlimited number of buffers,
giving all queuing features one would expect from a live source.

https://bugzilla.gnome.org/show_bug.cgi?id=782556
2017-07-11 14:26:31 +03:00
Sebastian Dröge
f0b1b97b25 decklink: Make timestamp reference specifier driver specific 2017-06-07 17:50:09 +03:00
Sebastian Dröge
c40b8a894d decklink: Sink the clock reference in the constructor
This is now needed as GstClock does not do that internally anymore,
because that broke bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:23 +03:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
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
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
Sebastian Dröge
28a16b5e94 decklink: Always use the video stream time for audio too
The audio packet times can be completely unrelated to the video stream
time, depending on the card. While this looks like a bug in the driver,
just always using the video stream time (which is correct) works as a
workaround for now.
2017-05-10 17:02:28 +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
8865b440d9 decklink: Fix linking on MinGW
MinGW does not provide comsupp.lib, so there's no implementation of
_com_util::ConvertBSTRToString. Use a fallback implementation that
uses wcstombs() instead.

On MinGW we also truncate the name to 100 chars which should be fine.
2017-05-05 17:49:22 +05:30
Nirbheek Chauhan
3d4c428e41 decklink: Fix building on Windows
BSTR is already a pointer to a string
2017-05-05 17:49:22 +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
Nirbheek Chauhan
e8e639081a meson: Fix decklink building on Windows
Needs comsuppw, and does not need libdl or pthread.
2017-05-05 17:49:21 +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
Tim-Philipp Müller
0ded4c1356 meson: decklink: fix meson configure error on macOS
"meson encountered an error in file
sys/decklink/meson.build, line 33, column 2:
Invalid use of addition: must be str, not list"

Also remove nonsensical linker flags on windows.

https://bugzilla.gnome.org/show_bug.cgi?id=781156
2017-04-11 09:43:53 +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
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