forked from mirrors/gstreamer-rs
Add GLDisplayX11 for gstreamer-gl
This commit is contained in:
parent
9931ac551e
commit
72aa5aed88
8 changed files with 139 additions and 6 deletions
|
@ -192,6 +192,12 @@ status = "generate"
|
||||||
final_type = true
|
final_type = true
|
||||||
cfg_condition = "feature = \"egl\""
|
cfg_condition = "feature = \"egl\""
|
||||||
|
|
||||||
|
[[object]]
|
||||||
|
name = "GstGL.GLDisplayX11"
|
||||||
|
status = "generate"
|
||||||
|
final_type = true
|
||||||
|
cfg_condition = "feature = \"x11\""
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstGL.GLWindow"
|
name = "GstGL.GLWindow"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -2658,8 +2658,67 @@ through the provided API</doc>
|
||||||
</bitfield>
|
</bitfield>
|
||||||
|
|
||||||
|
|
||||||
|
<class name="GLDisplayX11" c:symbol-prefix="gl_display_x11" c:type="GstGLDisplayX11" parent="GLDisplay" glib:type-name="GstGLDisplayX11" glib:get-type="gst_gl_display_x11_get_type" glib:type-struct="GLDisplayX11Class">
|
||||||
|
<doc xml:space="preserve">the contents of a #GstGLDisplayX11 are private and should only be accessed
|
||||||
|
through the provided API</doc>
|
||||||
|
<constructor name="new" c:identifier="gst_gl_display_x11_new">
|
||||||
|
<doc xml:space="preserve">Create a new #GstGLDisplayX11 from the x11 display name. See XOpenDisplay()
|
||||||
|
for details on what is a valid name.</doc>
|
||||||
|
<return-value transfer-ownership="full">
|
||||||
|
<doc xml:space="preserve">a new #GstGLDisplayX11 or %NULL</doc>
|
||||||
|
<type name="GLDisplayX11" c:type="GstGLDisplayX11*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="name" transfer-ownership="none" nullable="1" allow-none="1">
|
||||||
|
<doc xml:space="preserve">a display name</doc>
|
||||||
|
<type name="utf8" c:type="const gchar*"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</constructor>
|
||||||
|
<constructor name="new_with_display" c:identifier="gst_gl_display_x11_new_with_display" introspectable="0">
|
||||||
|
<doc xml:space="preserve">Creates a new display connection from a X11 Display.</doc>
|
||||||
|
<return-value transfer-ownership="full">
|
||||||
|
<doc xml:space="preserve">a new #GstGLDisplayX11</doc>
|
||||||
|
<type name="GLDisplayX11" c:type="GstGLDisplayX11*"/>
|
||||||
|
</return-value>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="display" transfer-ownership="none">
|
||||||
|
<doc xml:space="preserve">an existing, x11 display</doc>
|
||||||
|
<type c:type="gpointer" name="gpointer"/>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</constructor>
|
||||||
|
<field name="parent">
|
||||||
|
<type name="GLDisplay" c:type="GstGLDisplay"/>
|
||||||
|
</field>
|
||||||
|
<field name="name" readable="0" private="1">
|
||||||
|
<type name="utf8" c:type="gchar*"/>
|
||||||
|
</field>
|
||||||
|
<field name="display" introspectable="0" readable="0" private="1">
|
||||||
|
<type c:type="gpointer" name="gpointer"/>
|
||||||
|
</field>
|
||||||
|
<field name="xcb_connection" introspectable="0" readable="0" private="1">
|
||||||
|
<type c:type="gpointer" name="gpointer"/>
|
||||||
|
</field>
|
||||||
|
<field name="foreign_display" readable="0" private="1">
|
||||||
|
<type name="gboolean" c:type="gboolean"/>
|
||||||
|
</field>
|
||||||
|
<field name="_padding" readable="0" private="1">
|
||||||
|
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
|
||||||
|
<type name="gpointer" c:type="gpointer"/>
|
||||||
|
</array>
|
||||||
|
</field>
|
||||||
|
</class>
|
||||||
|
<record name="GLDisplayX11Class" c:type="GstGLDisplayX11Class" glib:is-gtype-struct-for="GLDisplayX11">
|
||||||
|
<field name="object_class">
|
||||||
|
<type name="GLDisplayClass" c:type="GstGLDisplayClass"/>
|
||||||
|
</field>
|
||||||
|
<field name="_padding">
|
||||||
|
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
|
||||||
|
<type name="gpointer" c:type="gpointer"/>
|
||||||
|
</array>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
<class name="GLFilter" c:symbol-prefix="gl_filter" c:type="GstGLFilter" parent="GLBaseFilter" glib:type-name="GstGLFilter" glib:get-type="gst_gl_filter_get_type" glib:type-struct="GLFilterClass">
|
<class name="GLFilter" c:symbol-prefix="gl_filter" c:type="GstGLFilter" parent="GLBaseFilter" glib:type-name="GstGLFilter" glib:get-type="gst_gl_filter_get_type" glib:type-struct="GLFilterClass">
|
||||||
<doc xml:space="preserve">#GstGLFilter helps to implement simple OpenGL filter elements taking a
|
<doc xml:space="preserve">#GstGLFilter helps to implement simple OpenGL filter elements taking a
|
||||||
single input and producing a single output with a #GstGLFramebuffer</doc>
|
single input and producing a single output with a #GstGLFramebuffer</doc>
|
||||||
|
|
|
@ -33,11 +33,17 @@ xmlstarlet ed --pf --inplace \
|
||||||
--delete '//_:record[@name="GLDisplayWaylandClass"]' \
|
--delete '//_:record[@name="GLDisplayWaylandClass"]' \
|
||||||
GstGL-1.0.gir
|
GstGL-1.0.gir
|
||||||
|
|
||||||
# Remove GstDisplayX11
|
# Change X11's Display* and xcb_connection_t* pointers to gpointer
|
||||||
xmlstarlet ed --pf --inplace \
|
xmlstarlet ed --pf --inplace \
|
||||||
--delete '//_:class[@name="GLDisplayX11"]' \
|
--insert '//_:type[@c:type="Display*"]' \
|
||||||
--delete '//_:record[@name="GLDisplayX11Class"]' \
|
--type attr --name 'name' --value 'gpointer' \
|
||||||
GstGL-1.0.gir
|
--insert '//_:type[@c:type="xcb_connection_t*"]' \
|
||||||
|
--type attr --name 'name' --value 'gpointer' \
|
||||||
|
--update '//*[@c:type="Display*"]/@c:type' \
|
||||||
|
--value gpointer \
|
||||||
|
--update '//*[@c:type="xcb_connection_t*"]/@c:type' \
|
||||||
|
--value gpointer \
|
||||||
|
GstGL-1.0.gir
|
||||||
|
|
||||||
# Remove GstMemoryEGL
|
# Remove GstMemoryEGL
|
||||||
xmlstarlet ed --pf --inplace \
|
xmlstarlet ed --pf --inplace \
|
||||||
|
|
|
@ -37,5 +37,6 @@ optional = true
|
||||||
default = []
|
default = []
|
||||||
dox = ["gstreamer-gl-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-base/dox"]
|
dox = ["gstreamer-gl-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-base/dox"]
|
||||||
egl = ["gstreamer-gl-sys/egl"]
|
egl = ["gstreamer-gl-sys/egl"]
|
||||||
|
x11 = ["gstreamer-gl-sys/x11"]
|
||||||
embed-lgpl-docs = ["rustdoc-stripper"]
|
embed-lgpl-docs = ["rustdoc-stripper"]
|
||||||
purge-lgpl-docs = ["rustdoc-stripper"]
|
purge-lgpl-docs = ["rustdoc-stripper"]
|
||||||
|
|
33
gstreamer-gl/src/auto/gl_display_x11.rs
Normal file
33
gstreamer-gl/src/auto/gl_display_x11.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use GLDisplay;
|
||||||
|
use ffi;
|
||||||
|
use glib::translate::*;
|
||||||
|
use gst;
|
||||||
|
|
||||||
|
glib_wrapper! {
|
||||||
|
pub struct GLDisplayX11(Object<ffi::GstGLDisplayX11, ffi::GstGLDisplayX11Class, GLDisplayX11Class>) @extends GLDisplay, gst::Object;
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
get_type => || ffi::gst_gl_display_x11_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GLDisplayX11 {
|
||||||
|
pub fn new<'a, P: Into<Option<&'a str>>>(name: P) -> GLDisplayX11 {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
let name = name.into();
|
||||||
|
unsafe {
|
||||||
|
from_glib_full(ffi::gst_gl_display_x11_new(name.to_glib_none().0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//pub fn new_with_display(display: /*Unimplemented*/Fundamental: Pointer) -> GLDisplayX11 {
|
||||||
|
// unsafe { TODO: call ffi::gst_gl_display_x11_new_with_display() }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for GLDisplayX11 {}
|
||||||
|
unsafe impl Sync for GLDisplayX11 {}
|
|
@ -22,6 +22,11 @@ mod gl_display_egl;
|
||||||
#[cfg(any(feature = "egl", feature = "dox"))]
|
#[cfg(any(feature = "egl", feature = "dox"))]
|
||||||
pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass};
|
pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass};
|
||||||
|
|
||||||
|
#[cfg(any(feature = "x11", feature = "dox"))]
|
||||||
|
mod gl_display_x11;
|
||||||
|
#[cfg(any(feature = "x11", feature = "dox"))]
|
||||||
|
pub use self::gl_display_x11::{GLDisplayX11, GLDisplayX11Class};
|
||||||
|
|
||||||
mod gl_framebuffer;
|
mod gl_framebuffer;
|
||||||
pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER};
|
pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER};
|
||||||
pub use self::gl_framebuffer::GLFramebufferExt;
|
pub use self::gl_framebuffer::GLFramebufferExt;
|
||||||
|
|
21
gstreamer-gl/src/gl_display_x11.rs
Normal file
21
gstreamer-gl/src/gl_display_x11.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (C) 2019 Víctor Jáquez <vjaquez@igalia.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
use ffi;
|
||||||
|
use glib::translate::*;
|
||||||
|
use glib_ffi::gpointer;
|
||||||
|
use libc::uintptr_t;
|
||||||
|
use GLDisplayX11;
|
||||||
|
|
||||||
|
impl GLDisplayX11 {
|
||||||
|
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayX11> {
|
||||||
|
from_glib_full(ffi::gst_gl_display_x11_new_with_display(
|
||||||
|
display as gpointer,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,8 @@ mod gl_display;
|
||||||
pub use gl_display::GL_DISPLAY_CONTEXT_TYPE;
|
pub use gl_display::GL_DISPLAY_CONTEXT_TYPE;
|
||||||
#[cfg(any(feature = "egl", feature = "dox"))]
|
#[cfg(any(feature = "egl", feature = "dox"))]
|
||||||
mod gl_display_egl;
|
mod gl_display_egl;
|
||||||
|
#[cfg(any(feature = "x11", feature = "dox"))]
|
||||||
|
mod gl_display_x11;
|
||||||
mod gl_video_frame;
|
mod gl_video_frame;
|
||||||
pub use gl_video_frame::VideoFrameGLExt;
|
pub use gl_video_frame::VideoFrameGLExt;
|
||||||
mod gl_sync_meta;
|
mod gl_sync_meta;
|
||||||
|
|
Loading…
Reference in a new issue