1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
// 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 glib;
use glib::object::IsA;
use glib::translate::*;
use gst;
use gst_gl_sys;
use GLContext;

glib_wrapper! {
    /// `GLColorConvert` is an object that converts between color spaces and/or
    /// formats using OpenGL Shaders.
    ///
    /// A `GLColorConvert` can be created with `GLColorConvert::new`, the
    /// configuration negotiated with `GLColorConvert::transform_caps` and the
    /// conversion performed with `GLColorConvert::perform`.
    ///
    /// The glcolorconvertelement provides a GStreamer element that uses
    /// `GLColorConvert` to convert between video formats and color spaces.
    ///
    /// # Implements
    ///
    /// [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
    pub struct GLColorConvert(Object<gst_gl_sys::GstGLColorConvert, gst_gl_sys::GstGLColorConvertClass, GLColorConvertClass>) @extends gst::Object;

    match fn {
        get_type => || gst_gl_sys::gst_gl_color_convert_get_type(),
    }
}

impl GLColorConvert {
    /// ## `context`
    /// a `GLContext`
    ///
    /// # Returns
    ///
    /// a new `GLColorConvert` object
    pub fn new<P: IsA<GLContext>>(context: &P) -> GLColorConvert {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(gst_gl_sys::gst_gl_color_convert_new(
                context.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Initializes `self` with the information required for conversion.
    /// ## `in_caps`
    /// input `gst::Caps`
    /// ## `out_caps`
    /// output `gst::Caps`
    pub fn set_caps(
        &self,
        in_caps: &gst::Caps,
        out_caps: &gst::Caps,
    ) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                gst_gl_sys::gst_gl_color_convert_set_caps(
                    self.to_glib_none().0,
                    in_caps.to_glib_none().0,
                    out_caps.to_glib_none().0
                ),
                "Failed to set caps"
            )
        }
    }

    /// Provides an implementation of `gst_base::BaseTransformClass.transform_caps`()
    /// ## `context`
    /// a `GLContext` to use for transforming `caps`
    /// ## `direction`
    /// a `gst::PadDirection`
    /// ## `caps`
    /// the `gst::Caps` to transform
    /// ## `filter`
    /// a set of filter `gst::Caps`
    ///
    /// # Returns
    ///
    /// the converted `gst::Caps`
    pub fn transform_caps<P: IsA<GLContext>>(
        context: &P,
        direction: gst::PadDirection,
        caps: &gst::Caps,
        filter: &gst::Caps,
    ) -> Option<gst::Caps> {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(gst_gl_sys::gst_gl_color_convert_transform_caps(
                context.as_ref().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 {}