Commit graph

213 commits

Author SHA1 Message Date
Sebastian Dröge
5725bad218 decklink: Fix compiler warning
gstdecklink.cpp: In member function ‘virtual HRESULT GStreamerDecklinkInputCallback::VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*)’:
gstdecklink.cpp:766:34: error: ‘base_time’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         capture_time -= base_time;
                                  ^
2016-11-29 15:35:09 +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
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
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
82edbde1fc decklink: Update to SDK 10.8
OSX and Linux only, Windows needs someone on Windows to convert the .idl
files to C source code.
2016-09-26 16:39:18 +03: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
1da1a3afc9 decklinkaudiosink: Fix compiler warning on OS X
While gint64 and int64_t are always the same, clang does not agree with that.

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C decklink
  CXX      libgstdecklink_la-gstdecklinkaudiosink.lo
gstdecklinkaudiosink.cpp:675:79: error: cannot initialize a parameter of type 'int64_t *' (aka 'long long *') with an rvalue of type 'gint64 *' (aka 'long *')
      ret = buf->output->attributes->GetInt (BMDDeckLinkMaximumAudioChannels, &max_channels);
                                                                              ^~~~~~~~~~~~~
./linux/DeckLinkAPI.h:692:87: note: passing argument to parameter 'value' here
    virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0;
                                                                                      ^
2016-08-26 16:05:11 +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
Sebastian Dröge
6fdd4d8288 decklinkaudiosink: Add support for 8 and 16 channels 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
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
a4ae449434 decklink: Fix swapped name and nick in GEnumValues
https://bugzilla.gnome.org/show_bug.cgi?id=742878
2016-05-03 15:57:23 +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
Sebastian Dröge
87503ac174 decklink: Fix indentation 2016-05-03 15:57:23 +03:00
Sebastian Dröge
da999d7af8 decklink: Initialize capture_time to NONE so it can be used if no video frame is provided but audio is
CID 1358390
2016-04-08 14:08:31 +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
Tim-Philipp Müller
8abff20185 decklinkvideosrc: don't crash if we get NULL video frames in the callback
For some reason we seem to sometimes get NULL video_frames in the
::VideoInputFrameArrived() callback, observed on Intensity Pro cards.

https://bugzilla.gnome.org/show_bug.cgi?id=747633
2016-04-05 14:46:22 +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
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
Heinrich Fink
6007829e77 decklink: Rename mode 2048p to 1556p
https://bugzilla.gnome.org/show_bug.cgi?id=749218
2015-05-11 13:20:11 +03:00
Heinrich Fink
1dabd7c5b8 decklink: Use correct frame rate for mode 2160p50
https://bugzilla.gnome.org/show_bug.cgi?id=749218
2015-05-11 13:14:39 +03:00
Heinrich Fink
e6d82dec32 decklink: Rename mode 3184p to 2160p
https://bugzilla.gnome.org/show_bug.cgi?id=749218
2015-05-11 13:14:15 +03: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
Josep Torra
6b70b848ee decklink: do not repeat first video format in caps template
The first entry in the modes array is used as default mode for autodetection.
There's no need to copy it into the caps template.
2015-04-22 17:20:21 +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