From 6e974cf4b9fcd05ed7807255b41743ff4319b0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 6 Jul 2024 13:56:24 +0300 Subject: [PATCH] gtk4: Document paintable properties correctly Part-of: --- docs/plugins/gst_plugins_cache.json | 78 +++++++++++++++++++++++++++- video/gtk4/src/lib.rs | 8 +++ video/gtk4/src/sink/imp.rs | 2 +- video/gtk4/src/sink/mod.rs | 2 +- video/gtk4/src/sink/paintable/mod.rs | 2 +- 5 files changed, 87 insertions(+), 5 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 4c368a15..6ee2c592 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -2565,7 +2565,7 @@ "controllable": false, "mutable": "null", "readable": true, - "type": "GdkPaintable", + "type": "GstGtk4Paintable", "writable": false } }, @@ -2574,7 +2574,81 @@ }, "filename": "gstgtk4", "license": "MPL", - "other-types": {}, + "other-types": { + "GstGtk4Paintable": { + "hierarchy": [ + "GstGtk4Paintable", + "GObject" + ], + "interfaces": [ + "GdkPaintable" + ], + "kind": "object", + "properties": { + "background-color": { + "blurb": "Background color to render behind the video frame and in the borders", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "255", + "max": "-1", + "min": "0", + "mutable": "null", + "readable": true, + "type": "guint", + "writable": true + }, + "force-aspect-ratio": { + "blurb": "When enabled, scaling will respect original aspect ratio", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, + "gl-context": { + "blurb": "GL context to use for rendering", + "conditionally-available": false, + "construct": false, + "construct-only": true, + "controllable": false, + "mutable": "null", + "readable": true, + "type": "GdkGLContext", + "writable": true + }, + "scaling-filter": { + "blurb": "Scaling filter to use for rendering", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "linear (0)", + "mutable": "null", + "readable": true, + "type": "GskScalingFilter", + "writable": true + }, + "use-scaling-filter": { + "blurb": "Use selected scaling filter or GTK default for rendering", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + } + } + } + }, "package": "gst-plugin-gtk4", "source": "gst-plugin-gtk4", "tracers": {}, diff --git a/video/gtk4/src/lib.rs b/video/gtk4/src/lib.rs index 0734da03..e0eecf1f 100644 --- a/video/gtk4/src/lib.rs +++ b/video/gtk4/src/lib.rs @@ -19,9 +19,17 @@ use gst::glib; mod sink; mod utils; +pub use sink::paintable::Paintable; pub use sink::PaintableSink; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { + #[cfg(feature = "doc")] + { + use gst::prelude::*; + + sink::paintable::Paintable::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty()); + } + #[cfg(not(feature = "gtk_v4_10"))] { if gtk::micro_version() >= 13 { diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index 8b4f2048..54e47bc4 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -89,7 +89,7 @@ impl ObjectImpl for PaintableSink { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { vec![ - glib::ParamSpecObject::builder::("paintable") + glib::ParamSpecObject::builder::("paintable") .nick("Paintable") .blurb("The Paintable the sink renders to") .read_only() diff --git a/video/gtk4/src/sink/mod.rs b/video/gtk4/src/sink/mod.rs index 06c263a6..f64e985d 100644 --- a/video/gtk4/src/sink/mod.rs +++ b/video/gtk4/src/sink/mod.rs @@ -40,7 +40,7 @@ use gtk::glib::prelude::*; mod frame; pub(super) mod imp; -mod paintable; +pub(super) mod paintable; enum SinkEvent { FrameChanged, diff --git a/video/gtk4/src/sink/paintable/mod.rs b/video/gtk4/src/sink/paintable/mod.rs index 63e42b3d..f7ced08c 100644 --- a/video/gtk4/src/sink/paintable/mod.rs +++ b/video/gtk4/src/sink/paintable/mod.rs @@ -22,7 +22,7 @@ glib::wrapper! { } impl Paintable { - pub fn new(context: Option) -> Self { + pub(crate) fn new(context: Option) -> Self { glib::Object::builder() .property("gl-context", context) .build()