Commit graph

53 commits

Author SHA1 Message Date
Sebastian Dröge 92891a61e8 Fix a couple of compiler/clippy warnings with --no-default-features
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1452>
2024-02-08 13:02:55 +02:00
Sebastian Dröge 4ad101b53b Use once_cell crate directly again
The glib crate does not depend on it anymore and also does not re-export
it anymore.

Also switch some usages of OnceCell to OnceLock from std.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1441>
2024-01-31 18:07:57 +02:00
François Laignel 9250c592a7 ndi: don't accumulate meta with audio only streams
Currently, only closed caption metadata are supported. When the next video
frame is received, pending meta are dequeued and parsed. If close captions
are found, they are attached to the video frame.

For audio only streams, it doesn't make sense to enqueue metadata. They would
accumulate in `pending_metadata` and would never be dequeued.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/460

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1392>
2023-11-13 19:26:23 +01:00
Sebastian Dröge 39155ef81c ndisrc: Implement zerocopy handling for the received frames if possible
Also move processing from the capture thread to the streaming thread.
The NDI SDK can cause frame drops if not reading fast enough from it.

All frame processing is now handled inside the ndisrcdemux.

Also use a buffer pool for video if copying is necessary.

Additionally, make sure to use different stream ids in the stream-start
event for the audio and video pad.

This plugin now requires GStreamer 1.16 or newer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1365>
2023-11-13 13:22:48 +02:00
Sebastian Dröge 2afffb39dd ndi: Don't mark private type as public
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1365>
2023-11-13 10:29:25 +02:00
Sebastian Dröge 99d7cce0d6 ndi: Refactor frame structs to have static lifetimes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1365>
2023-11-13 10:29:25 +02:00
Sebastian Dröge eb137ec6dc ndi: Remove wrong Clone impl on RecvInstance
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1365>
2023-11-13 10:29:25 +02:00
Sebastian Dröge 16b917abb1 Update for gst::Rank API changes 2023-11-02 14:10:59 +02:00
Sebastian Dröge 855b03a9ea Use let-else instead of match for weak reference upgrades
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1375>
2023-10-30 11:34:35 +02:00
Lieven Paulissen 05aa9fa431 ndisrc: Assume input with more than 8 raw audio channels is unpositioned
gst_audio_channel_positions_from_mask() will otherwise print warnings
all the time.

Fixes #444

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1357>
2023-10-12 09:12:02 +03:00
François Laignel 022afa6375 ndi: use v210 encoding for cc and attach to video frame
The NDI closed captions specifications [1] define a variation where metadata is
attached to the video frame. This requires the AFD buffer to be v210 encoded.
This commit applies this strategy.

Another difference with previous version is that when an error occurs while
encoding or decoding a meta, next meta are also tried instead of failing
immediately.

Receiving closed captions as a standalone metadata is kept for interoperability
purposes. In this case, metadata is also expected to be v210 encoded.

[1]: http://www.sienna-tv.com/ndi/ndiclosedcaptions.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1356>
2023-10-11 21:25:29 +02:00
Sebastian Dröge 450ffbe452 Update for VideoFrame / GLVideoFrame API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1345>
2023-10-02 13:25:25 +03:00
François Laignel 029fa9b8dc net/ndi: improve interoperability robustness
`quick-xml::reader::Reader::trim_text(true)` doesn't remove white spaces and
tabs from XML text. Besides, for interoperability robustness we also need to
remove carriage returns and line feeds.

Also improve the default capacities for the `SmallVec`s.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1321>
2023-09-11 06:22:41 +00:00
François Laignel 9604dea90a net/ndi: add closed caption support
Closed caption support in NDI is described as a proposal in [1] & [2].

The proposal consists in encapsulating c608 or c708 closed caption in ADF
packets and pushing them in an XML tag as part of NDI Metadata.

This commit implements this proposal.

[1]: http://www.sienna-tv.com/ndi/ndiclosedcaptions.html
[2]: http://www.sienna-tv.com/ndi/ndiclosedcaptions608.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1320>
2023-09-07 14:28:24 +02:00
Sebastian Dröge b0b63e58f8 ndi: Comment out empty Opus handling and add FIXME comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1308>
2023-08-29 12:21:38 +00:00
Bilal Elmoussaoui dd2d7d9215 Use re-exported once_cell
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268>
2023-07-06 17:50:49 +03:00
François Laignel 7ba0073052 use Pad builders for optional name definition
Also, apply auto-naming in the following cases

* When building from a non wildcard-named template, the name of the template is
  automatically assigned to the Pad. User can override with a specific name by
  calling `name()` on the `PadBuilder`.
* When building with a target and no name was provided via the above, the
  GhostPad is named after the target.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/448
Auto-naming discussion: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1255#note_1891181

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1197>
2023-05-12 12:55:31 +02:00
Sebastian Dröge 9cb211470f ndisrc: Fix copying of raw video frames with different NDI/GStreamer strides
And also don't copy each line twice for single-plane formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1158>
2023-04-05 16:45:48 +03:00
Vivia Nikolaidou cd74d01324 ndisinkcombiner: Properly handle caps changes
We are caching one video buffer, so previously we were changing the src
caps one buffer too early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1110>
2023-03-01 12:30:54 +00:00
Sebastian Dröge 458b2386ed Update for glib API changes 2023-01-21 18:13:48 +02:00
Sebastian Dröge 6132788b02 Update for caps/structure-related string API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1048>
2023-01-15 22:58:44 +02:00
Sebastian Dröge 3f904553ea Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1011>
2022-12-13 11:43:16 +02:00
Jordan Petridis 821c23e202 net/ndi: fix build with --no-default-features
doc_show_default() is only available with gst/v1_18

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/588>
2022-11-29 21:06:12 +02:00
Vivia Nikolaidou 5bbe0eab25 ndisrc: Use actual number of channels in positions_from_mask
Otherwise it fails for mono and stereo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/991>
2022-11-29 12:19:45 +02:00
Vivia Nikolaidou 73ce616bd9 ndisrc: Use default channel mask for audio output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/988>
2022-11-28 17:06:07 +02:00
Jan Beich 9aeaac5a96 ndi: provide Unix fallback after 3fe9e4a207
error[E0425]: cannot find value `LIBRARY_NAME` in this scope
   --> net/ndi/src/ndisys.rs:336:23
    |
336 |             path.push(LIBRARY_NAME);
    |                       ^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `LIBRARY_NAME` in this scope
   --> net/ndi/src/ndisys.rs:339:33
    |
339 |             path::PathBuf::from(LIBRARY_NAME)
    |                                 ^^^^^^^^^^^^ not found in this scope
2022-11-05 02:51:28 +00:00
Sebastian Dröge a8250abbf1 Fix various new clippy warnings 2022-11-01 10:27:48 +02:00
Sebastian Dröge 9a68f6e221 Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-23 23:08:46 +03:00
François Laignel 86776be58c Remove & for obj in log macros
This is no longer necessary.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1137
2022-10-23 21:22:31 +02:00
Sebastian Dröge f045099fc1 Fix GObject type names, GStreamer debug category names and element factory names
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/198
2022-10-23 20:46:08 +03:00
François Laignel 8011eadfd2 Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
2022-10-18 10:36:59 +00:00
Sebastian Dröge 862c2af1d9 ndi: Remove unnecessary explicit Send+Sync impls
These are automatically available now.
2022-10-13 17:54:08 +00:00
Sebastian Dröge 5f19639d0f ndi: Various code cleanup 2022-10-13 08:52:52 +00:00
Sebastian Dröge 97e0852156 ndi: Add NDI plugin to the docs 2022-10-12 22:25:13 +03:00
Sebastian Dröge 53b02a82ae ndi: Re-organize code a bit and don't make internal modules public 2022-10-12 22:09:56 +03:00
Sebastian Dröge 0a2e6e47c9 ndi: Silence some more clippy warnings 2022-10-12 22:09:55 +03:00
Sebastian Dröge db8037d16c ndi: Update for pad default functions API changes 2022-10-12 22:09:55 +03:00
Sebastian Dröge 3fe9e4a207 ndi: Implement dynamic loading of the NDI SDK
And build the plugin on the CI and via meson.
2022-10-12 22:09:53 +03:00
Sebastian Dröge 16c036e2cc ndi: Make element factory details and debug categories more consistent 2022-10-12 21:29:07 +03:00
Sebastian Dröge 907910329f ndi: Prefix GType names with Gst 2022-10-12 21:29:07 +03:00
Sebastian Dröge a000432b13 ndi: Relicense plugin from LGPL-2.1 to MPL-2
This was agreed to by all previous contributors in writing.
2022-10-12 21:29:07 +03:00
Sebastian Dröge fb8192f40b ndi: Remove unnecessary reference-timestamps feature 2022-10-12 21:29:07 +03:00
Vivia Nikolaidou fedd67dcaa ndi: Use AudioCapsBuilder and VideoCapsBuilder
Simplify caps creation codes
2022-10-12 21:29:07 +03:00
Vivia Nikolaidou 95e8deded9 ndi: Simplify code using ParamSpecBuilder 2022-10-12 21:29:07 +03:00
Vivia Nikolaidou 77a5e35081 ndi: Update to git version of the bindings 2022-10-12 21:29:07 +03:00
Vivia Nikolaidou 18cbb587ba ndisrcdemux: Add no-more-pads signal
Emit no-more-pads if we are adding the second pad of the element.
2022-10-12 21:29:07 +03:00
Sebastian Dröge 1c43a51520 ndisrcdemux: Use ANY caps in the pad templates of ndisrcdemux
When using the Advanced SDK it is possible to output compressed formats
too.
2022-10-12 21:29:07 +03:00
Sebastian Dröge 26f843a89f ndisrc: Fix latency reporting in auto timestamp mode 2022-10-12 21:29:07 +03:00
Sebastian Dröge 9c10ba87df ndisrc: Improve handling of broken sources with regards to timestamping
- NDI HX Camera Android in the past used 1ns instead of 100ns as unit
   for timecodes/timestamps.
 - NDI HX Camera iOS uses 0 for all timecodes and the same non-zero
   value for all audio timestamps

Detect such situations and try to compensate for them. Also add a new
"auto" timestamping mode that prefers to use timecodes and otherwise
falls back to timestamps or receive times.

Fixes https://github.com/teltek/gst-plugin-ndi/issues/79
2022-10-12 21:29:07 +03:00
Sebastian Dröge a3c752830b ndisrc: Keep track of audio/video and timestamp/timecode observations separately
Audio/video are in practice not always from the same clock and can have
different behaviours with regards to clock rate and jitter. Handling
them separately generally gives better results for the timestamps output
by the source element.
2022-10-12 21:29:07 +03:00