From 97e0852156224dc8f7cee52f5e39833a47287aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 12 Oct 2022 21:39:55 +0300 Subject: [PATCH] ndi: Add NDI plugin to the docs --- docs/plugins/gst_plugins_cache.json | 325 ++++++++++++++++++++++++++++ net/ndi/src/lib.rs | 24 +- net/ndi/src/ndisink/imp.rs | 2 +- net/ndi/src/ndisrc/imp.rs | 10 +- 4 files changed, 351 insertions(+), 10 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 44dbbfc0..e98a5a53 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -2319,6 +2319,331 @@ "tracers": {}, "url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" }, + "ndi": { + "description": "NewTek NDI Plugin", + "elements": { + "ndisink": { + "author": "Sebastian Dröge ", + "description": "NewTek NDI Sink", + "hierarchy": [ + "GstNdiSink", + "GstBaseSink", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Sink/Audio/Video", + "long-name": "NewTek NDI Sink", + "pad-templates": { + "sink": { + "caps": "video/x-raw:\n format: { UYVY, I420, NV12, NV21, YV12, BGRA, BGRx, RGBA, RGBx }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\naudio/x-raw:\n format: F32LE\n rate: [ 1, 2147483647 ]\n channels: [ 1, 2147483647 ]\n layout: interleaved\n", + "direction": "sink", + "presence": "always" + } + }, + "properties": { + "ndi-name": { + "blurb": "NDI Name to use", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "null", + "readable": true, + "type": "gchararray", + "writable": true + } + }, + "rank": "none" + }, + "ndisinkcombiner": { + "author": "Sebastian Dröge ", + "description": "NewTek NDI sink audio/video combiner", + "hierarchy": [ + "GstNdiSinkCombiner", + "GstAggregator", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Combiner/Audio/Video", + "long-name": "NewTek NDI Sink Combiner", + "pad-templates": { + "audio": { + "caps": "audio/x-raw:\n rate: [ 1, 2147483646 ]\n channels: [ 1, 2147483647 ]\n layout: interleaved\n format: F32LE\n", + "direction": "sink", + "presence": "request", + "type": "GstAggregatorPad" + }, + "src": { + "caps": "video/x-raw:\n format: { UYVY, I420, NV12, NV21, YV12, BGRA, BGRx, RGBA, RGBx }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 1/2147483647, 2147483646/1 ]\n", + "direction": "src", + "presence": "always", + "type": "GstAggregatorPad" + }, + "video": { + "caps": "video/x-raw:\n format: { UYVY, I420, NV12, NV21, YV12, BGRA, BGRx, RGBA, RGBx }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 1/2147483647, 2147483646/1 ]\n", + "direction": "sink", + "presence": "always", + "type": "GstAggregatorPad" + } + }, + "rank": "none" + }, + "ndisrc": { + "author": "Ruben Gonzalez , Daniel Vilar , Sebastian Dröge ", + "description": "NewTek NDI Source", + "hierarchy": [ + "GstNdiSrc", + "GstBaseSrc", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Source/Audio/Video/Network", + "long-name": "NewTek NDI Source", + "pad-templates": { + "src": { + "caps": "application/x-ndi:\n", + "direction": "src", + "presence": "always" + } + }, + "properties": { + "bandwidth": { + "blurb": "Bandwidth, -10 metadata-only, 10 audio-only, 100 highest", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "100", + "max": "100", + "min": "-10", + "mutable": "null", + "readable": true, + "type": "gint", + "writable": true + }, + "color-format": { + "blurb": "Receive color format", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "uyvy-bgra (1)", + "mutable": "null", + "readable": true, + "type": "GstNdiRecvColorFormat", + "writable": true + }, + "connect-timeout": { + "blurb": "Connection timeout in ms", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "10000", + "max": "-1", + "min": "0", + "mutable": "null", + "readable": true, + "type": "guint", + "writable": true + }, + "max-queue-length": { + "blurb": "Maximum receive queue length", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "10", + "max": "-1", + "min": "0", + "mutable": "null", + "readable": true, + "type": "guint", + "writable": true + }, + "ndi-name": { + "blurb": "NDI stream name of the sender", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "null", + "readable": true, + "type": "gchararray", + "writable": true + }, + "receiver-ndi-name": { + "blurb": "NDI stream name of this receiver", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "null", + "readable": true, + "type": "gchararray", + "writable": true + }, + "timeout": { + "blurb": "Receive timeout in ms", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "5000", + "max": "-1", + "min": "0", + "mutable": "null", + "readable": true, + "type": "guint", + "writable": true + }, + "timestamp-mode": { + "blurb": "Timestamp information to use for outgoing PTS", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "auto (0)", + "mutable": "null", + "readable": true, + "type": "GstNdiTimestampMode", + "writable": true + }, + "url-address": { + "blurb": "URL/address and port of the sender, e.g. 127.0.0.1:5961", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "NULL", + "mutable": "null", + "readable": true, + "type": "gchararray", + "writable": true + } + }, + "rank": "none" + }, + "ndisrcdemux": { + "author": "Sebastian Dröge ", + "description": "NewTek NDI source demuxer", + "hierarchy": [ + "GstNdiSrcDemux", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Demuxer/Audio/Video", + "long-name": "NewTek NDI Source Demuxer", + "pad-templates": { + "audio": { + "caps": "ANY", + "direction": "src", + "presence": "sometimes" + }, + "sink": { + "caps": "application/x-ndi:\n", + "direction": "sink", + "presence": "always" + }, + "video": { + "caps": "ANY", + "direction": "src", + "presence": "sometimes" + } + }, + "rank": "primary" + } + }, + "filename": "gstndi", + "license": "MPL", + "other-types": { + "GstNdiRecvColorFormat": { + "kind": "enum", + "values": [ + { + "desc": "BGRX or BGRA", + "name": "bgrx-bgra", + "value": "0" + }, + { + "desc": "UYVY or BGRA", + "name": "uyvy-bgra", + "value": "1" + }, + { + "desc": "RGBX or RGBA", + "name": "rgbx-rgba", + "value": "2" + }, + { + "desc": "UYVY or RGBA", + "name": "uyvy-rgba", + "value": "3" + }, + { + "desc": "Fastest", + "name": "fastest", + "value": "4" + }, + { + "desc": "Best", + "name": "best", + "value": "5" + } + ] + }, + "GstNdiTimestampMode": { + "kind": "enum", + "values": [ + { + "desc": "Auto", + "name": "auto", + "value": "0" + }, + { + "desc": "Receive Time / Timecode", + "name": "receive-time-vs-timecode", + "value": "1" + }, + { + "desc": "Receive Time / Timestamp", + "name": "receive-time-vs-timestamp", + "value": "2" + }, + { + "desc": "NDI Timecode", + "name": "timecode", + "value": "3" + }, + { + "desc": "NDI Timestamp", + "name": "timestamp", + "value": "4" + }, + { + "desc": "Receive Time", + "name": "receive-time", + "value": "5" + } + ] + } + }, + "package": "gst-plugin-ndi", + "source": "gst-plugin-ndi", + "tracers": {}, + "url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" + }, "raptorq": { "description": "Rust Raptorq FEC Plugin", "elements": { diff --git a/net/ndi/src/lib.rs b/net/ndi/src/lib.rs index ba82e9b3..97a0fc6a 100644 --- a/net/ndi/src/lib.rs +++ b/net/ndi/src/lib.rs @@ -1,4 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 +#![allow(unused_doc_comments)] + +/** + * plugin-ndi: + * + * Since: plugins-rs-0.9 + */ #[allow(dead_code)] mod ndi; @@ -18,6 +25,9 @@ mod ndisrc; mod ndisrcdemux; mod ndisrcmeta; +#[cfg(feature = "doc")] +use gst::prelude::*; + use once_cell::sync::Lazy; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] @@ -118,6 +128,11 @@ impl From for crate::ndisys::NDIlib_recv_color_format_e { } fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { + #[cfg(feature = "doc")] + TimestampMode::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty()); + #[cfg(feature = "doc")] + RecvColorFormat::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty()); + device_provider::register(plugin)?; ndisrc::register(plugin)?; @@ -128,17 +143,10 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { ndisinkcombiner::register(plugin)?; ndisink::register(plugin)?; } + Ok(()) } -static DEFAULT_RECEIVER_NDI_NAME: Lazy = Lazy::new(|| { - format!( - "GStreamer NDI Source {}-{}", - env!("CARGO_PKG_VERSION"), - env!("COMMIT_ID") - ) -}); - static TIMECODE_CAPS: Lazy = Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timecode", &[])); static TIMESTAMP_CAPS: Lazy = diff --git a/net/ndi/src/ndisink/imp.rs b/net/ndi/src/ndisink/imp.rs index cbf9a3e6..5dd95800 100644 --- a/net/ndi/src/ndisink/imp.rs +++ b/net/ndi/src/ndisink/imp.rs @@ -69,7 +69,7 @@ impl ObjectImpl for NdiSink { vec![glib::ParamSpecString::builder("ndi-name") .nick("NDI Name") .blurb("NDI Name to use") - .default_value(Some(DEFAULT_SENDER_NDI_NAME.as_ref())) + .doc_show_default() .build()] }); diff --git a/net/ndi/src/ndisrc/imp.rs b/net/ndi/src/ndisrc/imp.rs index d971e89a..ef7f2fd2 100644 --- a/net/ndi/src/ndisrc/imp.rs +++ b/net/ndi/src/ndisrc/imp.rs @@ -18,7 +18,6 @@ use crate::TimestampMode; use super::receiver::{self, Buffer, Receiver, ReceiverControlHandle, ReceiverItem}; use crate::ndisrcmeta; -use crate::DEFAULT_RECEIVER_NDI_NAME; static CAT: Lazy = Lazy::new(|| { gst::DebugCategory::new( @@ -28,6 +27,14 @@ static CAT: Lazy = Lazy::new(|| { ) }); +static DEFAULT_RECEIVER_NDI_NAME: Lazy = Lazy::new(|| { + format!( + "GStreamer NewTek NDI Source {}-{}", + env!("CARGO_PKG_VERSION"), + env!("COMMIT_ID") + ) +}); + #[derive(Debug, Clone)] struct Settings { ndi_name: Option, @@ -115,6 +122,7 @@ impl ObjectImpl for NdiSrc { glib::ParamSpecString::builder("receiver-ndi-name") .nick("Receiver NDI Name") .blurb("NDI stream name of this receiver") + .doc_show_default() .build(), glib::ParamSpecUInt::builder("connect-timeout") .nick("Connect Timeout")