Add GstGL bindings

parent e0953efd
......@@ -13,4 +13,5 @@ ignore = [
"gstreamer-video/src/auto",
"gstreamer-webrtc/src/auto",
"gstreamer-editing-services/src/auto",
"gstreamer-gl/src/auto",
]
......@@ -15,6 +15,7 @@ members = [
"gstreamer-webrtc",
"gstreamer-check",
"gstreamer-editing-services",
"gstreamer-gl",
"examples",
"tutorials",
]
[options]
girs_dir = "gir-files"
library = "GstGL"
version = "1.0"
min_cfg_version = "1.14"
target_path = "gstreamer-gl"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"GstBase",
"GstVideo",
]
generate = [
# BitFlags
"GstGL.GLAPI",
"GstGL.GLDisplayType",
"GstGL.GLPlatform",
"GstGL.GLSLProfile",
# Enums
"GstGL.GLFormat",
"GstGL.GLQueryType",
"GstGL.GLSLVersion",
"GstGL.GLTextureTarget",
"GstGL.GLStereoDownmix",
"GstGL.GLUploadReturn",
# Enums Errors
#"GstGL.GLBaseMemoryError",
"GstGL.GLContextError",
"GstGL.GLSLError",
"GstGL.GLWindowError",
# Records
#"GstGL.GLAllocationParams",
#"GstGL.GLRenderbufferAllocationParams",
#"GstGL.GLVideoAllocationParams",
# Objects
"GstGL.GLBaseFilter",
#"GstGL.GLBufferPool",
"GstGL.GLFramebuffer",
#"GstGL.GLBaseMemory",
#"GstGL.GLBaseMemoryAllocator",
#"GstGL.GLMemoryPBOAllocator",
#"GstGL.GLRenderbufferAllocator",
]
manual = [
"GLib.Error",
"GLib.Thread",
"GObject.Object",
"Gst.Object",
"Gst.FlowReturn",
"Gst.PadDirection",
"GstVideo.VideoMultiviewFlags",
"GstVideo.VideoMultiviewMode",
]
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref-mut"
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Query"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLBuffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLQuery"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstGL.GLContext"
status = "generate"
[[object.function]]
name = "new_wrapped"
# input handle
ignore = true
[[object.function]]
name = "get_gl_context"
# return handle
ignore = true
[[object.function]]
name = "get_current_gl_context"
# return handle
ignore = true
[[object.function]]
name = "get_proc_address"
ignore = true
[[object.function]]
name = "default_get_proc_address"
ignore = true
[[object.function]]
name = "get_proc_address_with_platform"
ignore = true
[[object.function]]
name = "thread_add"
# unimplemented GLContextThreadFunc
ignore = true
[[object.function]]
name = "get_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "get_gl_context_for_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "error_quark"
# bad error domian definition in gir
ignore = true
[[object.function]]
name = "activate"
[object.function.return]
bool_return_is_error = "Failed to activate OpenGL context"
[[object.function]]
name = "get_display"
[object.function.return]
nullable = false
[[object]]
name = "GstGL.GLDisplay"
status = "generate"
[[object.function]]
name = "find_window"
# unimplemented pointer
ignore = true
[[object.function]]
name = "get_handle"
# return handle
ignore = true
[[object.function]]
name = "get_gl_context_for_thread"
# glib::Thread not found in `glib`
ignore = true
[[object.function]]
name = "add_context"
[object.function.return]
bool_return_is_error = "Failed to add OpenGL context"
[[object.function]]
name = "remove_window"
[object.function.return]
bool_return_is_error = "Failed to remove window"
[[object]]
name = "GstGL.GLDisplayEGL"
status = "generate"
trait = false
cfg_condition = "feature = \"egl\""
[[object]]
name = "GstGL.GLWindow"
status = "generate"
[[object.function]]
name = "get_window_handle"
# return native handle
ignore = true
[[object.function]]
name = "send_message"
# callback
ignore = true
[[object.function]]
name = "send_message_async"
# callback
ignore = true
[[object.function]]
name = "set_close_callback"
# callback
ignore = true
[[object.function]]
name = "set_draw_callback"
# callback
ignore = true
[[object.function]]
name = "set_resize_callback"
# callback
ignore = true
[[object.function]]
name = "set_window_handle"
# handle
ignore = true
[[object.function]]
name = "get_display"
# handle
ignore = true
[[object.function]]
name = "error_quark"
# bad error domian definition in gir
ignore = true
[[object]]
name = "GstGL.GLColorConvert"
status = "generate"
trait = false
[[object.function]]
name = "decide_allocation"
# correct mutability
ignore = true
[[object.function]]
name = "fixate_caps"
# correct reference ownership
ignore = true
[[object.function]]
name = "perform"
# transfer gst::Buffer not reference
ignore = true
[[object]]
name = "GstGL.GLOverlayCompositor"
status = "generate"
trait = false
[[object.function]]
name = "upload_overlays"
# correct mutability
ignore = true
[[object]]
name = "GstGL.GLSLStage"
status = "generate"
trait = false
[[object]]
name = "GstGL.GLShader"
status = "generate"
trait = false
[[object.function]]
name = "set_uniform_matrix_2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_2x3fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_2x4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3x2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_3x4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4x2fv"
# array with size
ignore = true
[[object.function]]
name = "set_uniform_matrix_4x3fv"
# array with size
ignore = true
[[object]]
name = "GstGL.GLUpload"
status = "generate"
trait = false
[[object.function]]
name = "perform_with_buffer"
# Result<Buffer, GLUploadReturn>
ignore = true
[[object.function]]
name = "propose_allocation"
# fix mutability
ignore = true
[[object.function]]
name = "get_input_template_caps"
[object.function.return]
nullable = false
[[object]]
name = "GstGL.GLViewConvert"
status = "generate"
trait = false
[[object.function]]
name = "fixate_caps"
# correct reference ownership
ignore = true
[[object.function]]
name = "get_output"
# Result<Buffer, FlowReturn>
ignore = true
[[object.function]]
name = "tranform_caps"
[object.function.return]
nullable = false
[[object.function]]
name = "submit_input_buffer"
# Buffer ownership transfer
ignore = true
This diff is collapsed.
[package]
name = "gstreamer-gl"
version = "0.13.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>",
"Víctor M. Jáquez L. <vjaquez@igalia.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer GL library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_gl"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
byteorder = "1"
libc = "0.2"
lazy_static = "1.0"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" }
gstreamer-base-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_14"] }
gstreamer-video-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_14"] }
gstreamer-gl-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" }
glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer", features = ["v1_14"] }
gstreamer-base = { path = "../gstreamer-base", features = ["v1_14"] }
gstreamer-video = { path = "../gstreamer-video", features = ["v1_14"] }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
default-features = []
dox = ["gstreamer-gl-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-base/dox"]
egl = ["gstreamer-gl-sys/egl"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
This diff is collapsed.
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
fn main() {
manage_docs();
}
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
fn manage_docs() {
extern crate stripper_lib;
use std::io;
let path = "src";
let ignores: &[&str] = &[];
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true),
&ignores,
false,
);
#[cfg(feature = "embed-lgpl-docs")]
{
let docs = include_str!("../docs/gstreamer-gl/docs.md");
let mut infos = stripper_lib::parse_cmts(docs.lines(), true);
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true),
&ignores,
false,
);
}
}
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
fn manage_docs() {}
This diff is collapsed.
// 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 ffi;
use glib::translate::*;
bitflags! {
pub struct GLAPI: u32 {
const NONE = 0;
const OPENGL = 1;
const OPENGL3 = 2;
const GLES1 = 32768;
const GLES2 = 65536;
const ANY = 4294967295;
}
}
#[doc(hidden)]
impl ToGlib for GLAPI {
type GlibType = ffi::GstGLAPI;
fn to_glib(&self) -> ffi::GstGLAPI {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstGLAPI> for GLAPI {
fn from_glib(value: ffi::GstGLAPI) -> GLAPI {
skip_assert_initialized!();
GLAPI::from_bits_truncate(value)
}
}
bitflags! {
pub struct GLDisplayType: u32 {
const NONE = 0;
const X11 = 1;
const WAYLAND = 2;
const COCOA = 4;
const WIN32 = 8;
const DISPMANX = 16;
const EGL = 32;
const VIV_FB = 64;
const GBM = 128;
const ANY = 4294967295;
}
}
#[doc(hidden)]
impl ToGlib for GLDisplayType {
type GlibType = ffi::GstGLDisplayType;
fn to_glib(&self) -> ffi::GstGLDisplayType {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstGLDisplayType> for GLDisplayType {
fn from_glib(value: ffi::GstGLDisplayType) -> GLDisplayType {
skip_assert_initialized!();
GLDisplayType::from_bits_truncate(value)
}
}
bitflags! {
pub struct GLPlatform: u32 {
const NONE = 0;
const EGL = 1;
const GLX = 2;
const WGL = 4;
const CGL = 8;
const EAGL = 16;
const ANY = 4294967295;
}
}
#[doc(hidden)]
impl ToGlib for GLPlatform {
type GlibType = ffi::GstGLPlatform;
fn to_glib(&self) -> ffi::GstGLPlatform {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstGLPlatform> for GLPlatform {
fn from_glib(value: ffi::GstGLPlatform) -> GLPlatform {
skip_assert_initialized!();
GLPlatform::from_bits_truncate(value)
}
}
bitflags! {
pub struct GLSLProfile: u32 {
const NONE = 0;
const ES = 1;
const CORE = 2;
const COMPATIBILITY = 4;
const ANY = 4294967295;
}
}
#[doc(hidden)]
impl ToGlib for GLSLProfile {
type GlibType = ffi::GstGLSLProfile;
fn to_glib(&self) -> ffi::GstGLSLProfile {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstGLSLProfile> for GLSLProfile {
fn from_glib(value: ffi::GstGLSLProfile) -> GLSLProfile {
skip_assert_initialized!();
GLSLProfile::from_bits_truncate(value)
}
}
// 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 GLContext;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct GLBaseFilter(Object<ffi::GstGLBaseFilter, ffi::GstGLBaseFilterClass>): [
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_gl_base_filter_get_type(),
}
}
unsafe impl Send for GLBaseFilter {}
unsafe impl Sync for GLBaseFilter {}
pub trait GLBaseFilterExt {
fn get_property_context(&self) -> Option<GLContext>;
fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<GLBaseFilter> + IsA<glib::object::Object>> GLBaseFilterExt for O {
fn get_property_context(&self) -> Option<GLContext> {
unsafe {
let mut value = Value::from_type(<GLContext as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "context".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::context",
transmute(notify_context_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_context_trampoline<P>(this: *mut ffi::GstGLBaseFilter, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<GLBaseFilter> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&GLBaseFilter::from_glib_borrow(this).downcast_unchecked())
}
// 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 GLContext;
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct GLColorConvert(Object<ffi::GstGLColorConvert, ffi::GstGLColorConvertClass>): [
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_gl_color_convert_get_type(),
}
}
impl GLColorConvert {
pub fn new(context: &GLContext) -> GLColorConvert {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_gl_color_convert_new(context.to_glib_none().0))
}
}
pub fn set_caps(&self, in_caps: &gst::Caps, out_caps: &gst::Caps) -> bool {
unsafe {
from_glib(ffi::gst_gl_color_convert_set_caps(self.to_glib_none().0, in_caps.to_glib_none().0, out_caps.to_glib_none().0))
}
}
pub fn transform_caps(context: &GLContext, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option<gst::Caps> {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_gl_color_convert_transform_caps(context.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0))
}
}
}
unsafe impl Send for GLColorConvert {}
unsafe impl Sync for GLColorConvert {}
// 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 Error;
use GLAPI;
use GLDisplay;
use GLPlatform;
use GLSLProfile;
use GLSLVersion;
use GLWindow;
use ffi;
use glib;
use glib::object::IsA;