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
// 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::translate::*;
use glib::GString;
use gst_pbutils_sys;
use std::mem;
use EncodingTarget;

pub fn encoding_list_all_targets(categoryname: Option<&str>) -> Vec<EncodingTarget> {
    assert_initialized_main_thread!();
    unsafe {
        FromGlibPtrContainer::from_glib_full(gst_pbutils_sys::gst_encoding_list_all_targets(
            categoryname.to_glib_none().0,
        ))
    }
}

pub fn encoding_list_available_categories() -> Vec<GString> {
    assert_initialized_main_thread!();
    unsafe {
        FromGlibPtrContainer::from_glib_full(
            gst_pbutils_sys::gst_encoding_list_available_categories(),
        )
    }
}

pub fn pb_utils_get_element_description(factory_name: &str) -> Result<GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(gst_pbutils_sys::gst_pb_utils_get_element_description(
            factory_name.to_glib_none().0,
        ))
        .ok_or_else(|| glib_bool_error!("Failed to get element description"))
    }
}

pub fn pb_utils_get_sink_description(protocol: &str) -> Result<GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(gst_pbutils_sys::gst_pb_utils_get_sink_description(
            protocol.to_glib_none().0,
        ))
        .ok_or_else(|| glib_bool_error!("Failed to get sink description"))
    }
}

pub fn pb_utils_get_source_description(protocol: &str) -> Result<GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(gst_pbutils_sys::gst_pb_utils_get_source_description(
            protocol.to_glib_none().0,
        ))
        .ok_or_else(|| glib_bool_error!("Failed to get source description"))
    }
}

pub fn plugins_base_version() -> (u32, u32, u32, u32) {
    skip_assert_initialized!();
    unsafe {
        let mut major = mem::MaybeUninit::uninit();
        let mut minor = mem::MaybeUninit::uninit();
        let mut micro = mem::MaybeUninit::uninit();
        let mut nano = mem::MaybeUninit::uninit();
        gst_pbutils_sys::gst_plugins_base_version(
            major.as_mut_ptr(),
            minor.as_mut_ptr(),
            micro.as_mut_ptr(),
            nano.as_mut_ptr(),
        );
        let major = major.assume_init();
        let minor = minor.assume_init();
        let micro = micro.assume_init();
        let nano = nano.assume_init();
        (major, minor, micro, nano)
    }
}

pub fn plugins_base_version_string() -> GString {
    skip_assert_initialized!();
    unsafe { from_glib_full(gst_pbutils_sys::gst_plugins_base_version_string()) }
}