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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::EncodingTarget;
use glib::translate::*;
use std::mem;

/// List all available [`EncodingTarget`][crate::EncodingTarget] for the specified category, or all categories
/// if `categoryname` is [`None`].
/// ## `categoryname`
/// The category, for ex: `GST_ENCODING_CATEGORY_DEVICE`.
/// Can be [`None`].
///
/// # Returns
///
/// The list of [`EncodingTarget`][crate::EncodingTarget]
#[doc(alias = "gst_encoding_list_all_targets")]
pub fn encoding_list_all_targets(categoryname: Option<&str>) -> Vec<EncodingTarget> {
    assert_initialized_main_thread!();
    unsafe {
        FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets(
            categoryname.to_glib_none().0,
        ))
    }
}

/// Lists all [`EncodingTarget`][crate::EncodingTarget] categories present on disk.
///
/// # Returns
///
/// A list
/// of [`EncodingTarget`][crate::EncodingTarget] categories.
#[doc(alias = "gst_encoding_list_available_categories")]
pub fn encoding_list_available_categories() -> Vec<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_available_categories()) }
}

/// Returns a localised string describing the given element, for use in
/// error dialogs or other messages to be seen by the user. Should never
/// return NULL unless `factory_name` is invalid.
///
/// This function is mainly for internal use, applications would typically
/// use `gst_missing_plugin_message_get_description()` to get a description of
/// a missing feature from a missing-plugin message.
/// ## `factory_name`
/// the name of the element, e.g. "giosrc"
///
/// # Returns
///
/// a newly-allocated description string, or NULL on error. Free
///  string with `g_free()` when not needed any longer.
#[doc(alias = "gst_pb_utils_get_element_description")]
pub fn pb_utils_get_element_description(
    factory_name: &str,
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(ffi::gst_pb_utils_get_element_description(
            factory_name.to_glib_none().0,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get element description"))
    }
}

/// Returns a localised string describing a sink element handling the protocol
/// specified in `protocol`, for use in error dialogs or other messages to be
/// seen by the user. Should never return NULL unless `protocol` is invalid.
///
/// This function is mainly for internal use, applications would typically
/// use `gst_missing_plugin_message_get_description()` to get a description of
/// a missing feature from a missing-plugin message.
/// ## `protocol`
/// the protocol the sink element needs to handle, e.g. "http"
///
/// # Returns
///
/// a newly-allocated description string, or NULL on error. Free
///  string with `g_free()` when not needed any longer.
#[doc(alias = "gst_pb_utils_get_sink_description")]
pub fn pb_utils_get_sink_description(protocol: &str) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(ffi::gst_pb_utils_get_sink_description(
            protocol.to_glib_none().0,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get sink description"))
    }
}

/// Returns a localised string describing a source element handling the protocol
/// specified in `protocol`, for use in error dialogs or other messages to be
/// seen by the user. Should never return NULL unless `protocol` is invalid.
///
/// This function is mainly for internal use, applications would typically
/// use `gst_missing_plugin_message_get_description()` to get a description of
/// a missing feature from a missing-plugin message.
/// ## `protocol`
/// the protocol the source element needs to handle, e.g. "http"
///
/// # Returns
///
/// a newly-allocated description string, or NULL on error. Free
///  string with `g_free()` when not needed any longer.
#[doc(alias = "gst_pb_utils_get_source_description")]
pub fn pb_utils_get_source_description(protocol: &str) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    unsafe {
        Option::<_>::from_glib_full(ffi::gst_pb_utils_get_source_description(
            protocol.to_glib_none().0,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get source description"))
    }
}

/// Gets the version number of the GStreamer Plugins Base libraries.
///
/// # Returns
///
///
/// ## `major`
/// pointer to a guint to store the major version number, or [`None`]
///
/// ## `minor`
/// pointer to a guint to store the minor version number, or [`None`]
///
/// ## `micro`
/// pointer to a guint to store the micro version number, or [`None`]
///
/// ## `nano`
/// pointer to a guint to store the nano version number, or [`None`]
#[doc(alias = "gst_plugins_base_version")]
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();
        ffi::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)
    }
}

/// This function returns a string that is useful for describing this version
/// of GStreamer's gst-plugins-base libraries to the outside world: user agent
/// strings, logging, about dialogs ...
///
/// # Returns
///
/// a newly allocated string describing this version of gst-plugins-base
#[doc(alias = "gst_plugins_base_version_string")]
pub fn plugins_base_version_string() -> glib::GString {
    skip_assert_initialized!();
    unsafe { from_glib_full(ffi::gst_plugins_base_version_string()) }
}