gstreamer-rs/gstreamer-gl/src/auto/gl_shader.rs
2018-12-08 14:58:14 +02:00

273 lines
9 KiB
Rust

// 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 GLContext;
use GLSLStage;
use ffi;
use glib::StaticType;
use glib::Value;
use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct GLShader(Object<ffi::GstGLShader, ffi::GstGLShaderClass>): [
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_gl_shader_get_type(),
}
}
impl GLShader {
pub fn new(context: &GLContext) -> GLShader {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_gl_shader_new(context.to_glib_none().0))
}
}
pub fn new_default(context: &GLContext) -> Result<GLShader, Error> {
skip_assert_initialized!();
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::gst_gl_shader_new_default(context.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
//pub fn new_link_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader {
// unsafe { TODO: call ffi::gst_gl_shader_new_link_with_stages() }
//}
//pub fn new_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader {
// unsafe { TODO: call ffi::gst_gl_shader_new_with_stages() }
//}
pub fn attach(&self, stage: &GLSLStage) -> bool {
unsafe {
from_glib(ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0))
}
}
pub fn attach_unlocked(&self, stage: &GLSLStage) -> bool {
unsafe {
from_glib(ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0))
}
}
pub fn bind_attribute_location(&self, index: u32, name: &str) {
unsafe {
ffi::gst_gl_shader_bind_attribute_location(self.to_glib_none().0, index, name.to_glib_none().0);
}
}
pub fn bind_frag_data_location(&self, index: u32, name: &str) {
unsafe {
ffi::gst_gl_shader_bind_frag_data_location(self.to_glib_none().0, index, name.to_glib_none().0);
}
}
pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn detach(&self, stage: &GLSLStage) {
unsafe {
ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.to_glib_none().0);
}
}
pub fn detach_unlocked(&self, stage: &GLSLStage) {
unsafe {
ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0);
}
}
pub fn get_attribute_location(&self, name: &str) -> i32 {
unsafe {
ffi::gst_gl_shader_get_attribute_location(self.to_glib_none().0, name.to_glib_none().0)
}
}
pub fn get_program_handle(&self) -> i32 {
unsafe {
ffi::gst_gl_shader_get_program_handle(self.to_glib_none().0)
}
}
pub fn is_linked(&self) -> bool {
unsafe {
from_glib(ffi::gst_gl_shader_is_linked(self.to_glib_none().0))
}
}
pub fn link(&self) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::gst_gl_shader_link(self.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn release(&self) {
unsafe {
ffi::gst_gl_shader_release(self.to_glib_none().0);
}
}
pub fn release_unlocked(&self) {
unsafe {
ffi::gst_gl_shader_release_unlocked(self.to_glib_none().0);
}
}
pub fn set_uniform_1f(&self, name: &str, value: f32) {
unsafe {
ffi::gst_gl_shader_set_uniform_1f(self.to_glib_none().0, name.to_glib_none().0, value);
}
}
pub fn set_uniform_1fv(&self, name: &str, value: &[f32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_1fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_1i(&self, name: &str, value: i32) {
unsafe {
ffi::gst_gl_shader_set_uniform_1i(self.to_glib_none().0, name.to_glib_none().0, value);
}
}
pub fn set_uniform_1iv(&self, name: &str, value: &[i32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_1iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_2f(&self, name: &str, v0: f32, v1: f32) {
unsafe {
ffi::gst_gl_shader_set_uniform_2f(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
}
}
pub fn set_uniform_2fv(&self, name: &str, value: &[f32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_2fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_2i(&self, name: &str, v0: i32, v1: i32) {
unsafe {
ffi::gst_gl_shader_set_uniform_2i(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
}
}
pub fn set_uniform_2iv(&self, name: &str, value: &[i32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_2iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_3f(&self, name: &str, v0: f32, v1: f32, v2: f32) {
unsafe {
ffi::gst_gl_shader_set_uniform_3f(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2);
}
}
pub fn set_uniform_3fv(&self, name: &str, value: &[f32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_3fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_3i(&self, name: &str, v0: i32, v1: i32, v2: i32) {
unsafe {
ffi::gst_gl_shader_set_uniform_3i(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2);
}
}
pub fn set_uniform_3iv(&self, name: &str, value: &[i32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_3iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_4f(&self, name: &str, v0: f32, v1: f32, v2: f32, v3: f32) {
unsafe {
ffi::gst_gl_shader_set_uniform_4f(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2, v3);
}
}
pub fn set_uniform_4fv(&self, name: &str, value: &[f32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_4fv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn set_uniform_4i(&self, name: &str, v0: i32, v1: i32, v2: i32, v3: i32) {
unsafe {
ffi::gst_gl_shader_set_uniform_4i(self.to_glib_none().0, name.to_glib_none().0, v0, v1, v2, v3);
}
}
pub fn set_uniform_4iv(&self, name: &str, value: &[i32]) {
let count = value.len() as u32;
unsafe {
ffi::gst_gl_shader_set_uniform_4iv(self.to_glib_none().0, name.to_glib_none().0, count, value.to_glib_none().0);
}
}
pub fn use_(&self) {
unsafe {
ffi::gst_gl_shader_use(self.to_glib_none().0);
}
}
pub fn get_property_linked(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn connect_property_linked_notify<F: Fn(&GLShader) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&GLShader) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::linked\0".as_ptr() as *const _,
transmute(notify_linked_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe impl Send for GLShader {}
unsafe impl Sync for GLShader {}
unsafe extern "C" fn notify_linked_trampoline(this: *mut ffi::GstGLShader, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&GLShader) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}