stream_collection.rs 2.95 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT

use Object;
#[cfg(feature = "v1_10")]
use Stream;
use ffi;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;

glib_wrapper! {
    pub struct StreamCollection(Object<ffi::GstStreamCollection>): Object;

    match fn {
        get_type => || ffi::gst_stream_collection_get_type(),
    }
}

impl StreamCollection {
    #[cfg(feature = "v1_10")]
    pub fn new<'a, P: Into<Option<&'a str>>>(upstream_id: P) -> StreamCollection {
25
        assert_initialized_main_thread!();
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
        let upstream_id = upstream_id.into();
        let upstream_id = upstream_id.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_stream_collection_new(upstream_id.0))
        }
    }
}

unsafe impl Send for StreamCollection {}
unsafe impl Sync for StreamCollection {}

pub trait StreamCollectionExt {
    #[cfg(feature = "v1_10")]
    fn add_stream(&self, stream: &Stream) -> bool;

    #[cfg(feature = "v1_10")]
    fn get_size(&self) -> u32;

    #[cfg(feature = "v1_10")]
    fn get_stream(&self, index: u32) -> Option<Stream>;

    #[cfg(feature = "v1_10")]
    fn get_upstream_id(&self) -> Option<String>;

    fn get_property_upstream_id(&self) -> Option<String>;

    fn set_property_upstream_id(&self, upstream_id: Option<&str>);

    //fn connect_stream_notify<Unsupported or ignored types>(&self, f: F) -> u64;
}

impl<O: IsA<StreamCollection> + IsA<glib::object::Object>> StreamCollectionExt for O {
    #[cfg(feature = "v1_10")]
    fn add_stream(&self, stream: &Stream) -> bool {
        unsafe {
            from_glib(ffi::gst_stream_collection_add_stream(self.to_glib_none().0, stream.to_glib_full()))
        }
    }

    #[cfg(feature = "v1_10")]
    fn get_size(&self) -> u32 {
        unsafe {
            ffi::gst_stream_collection_get_size(self.to_glib_none().0)
        }
    }

    #[cfg(feature = "v1_10")]
    fn get_stream(&self, index: u32) -> Option<Stream> {
        unsafe {
            from_glib_none(ffi::gst_stream_collection_get_stream(self.to_glib_none().0, index))
        }
    }

    #[cfg(feature = "v1_10")]
    fn get_upstream_id(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_stream_collection_get_upstream_id(self.to_glib_none().0))
        }
    }

    fn get_property_upstream_id(&self) -> Option<String> {
        let mut value = Value::from(None::<&str>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "upstream-id".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

    fn set_property_upstream_id(&self, upstream_id: Option<&str>) {
        unsafe {
            gobject_ffi::g_object_set_property(self.to_glib_none().0, "upstream-id".to_glib_none().0, Value::from(upstream_id).to_glib_none().0);
        }
    }

    //fn connect_stream_notify<Unsupported or ignored types>(&self, f: F) -> u64 {
    //    Ignored p0: GObject.ParamSpec
    //}
}