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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
// 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::*;

#[doc(alias = "gst_codec_utils_aac_get_channels")]
pub fn codec_utils_aac_get_channels(audio_config: &[u8]) -> u32 {
    assert_initialized_main_thread!();
    let len = audio_config.len() as _;
    unsafe { ffi::gst_codec_utils_aac_get_channels(audio_config.to_glib_none().0, len) }
}

#[doc(alias = "gst_codec_utils_aac_get_index_from_sample_rate")]
pub fn codec_utils_aac_get_index_from_sample_rate(rate: u32) -> i32 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_codec_utils_aac_get_index_from_sample_rate(rate) }
}

#[doc(alias = "gst_codec_utils_aac_get_level")]
pub fn codec_utils_aac_get_level(audio_config: &[u8]) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = audio_config.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_aac_get_level(
            audio_config.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get AAC level"))
    }
}

#[doc(alias = "gst_codec_utils_aac_get_profile")]
pub fn codec_utils_aac_get_profile(audio_config: &[u8]) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = audio_config.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_aac_get_profile(
            audio_config.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get AAC profile"))
    }
}

#[doc(alias = "gst_codec_utils_aac_get_sample_rate")]
pub fn codec_utils_aac_get_sample_rate(audio_config: &[u8]) -> u32 {
    assert_initialized_main_thread!();
    let len = audio_config.len() as _;
    unsafe { ffi::gst_codec_utils_aac_get_sample_rate(audio_config.to_glib_none().0, len) }
}

#[doc(alias = "gst_codec_utils_aac_get_sample_rate_from_index")]
pub fn codec_utils_aac_get_sample_rate_from_index(sr_idx: u32) -> u32 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_codec_utils_aac_get_sample_rate_from_index(sr_idx) }
}

#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_codec_utils_caps_from_mime_codec")]
pub fn codec_utils_caps_from_mime_codec(codecs_field: &str) -> Option<gst::Caps> {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_full(ffi::gst_codec_utils_caps_from_mime_codec(
            codecs_field.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_codec_utils_h264_get_level")]
pub fn codec_utils_h264_get_level(sps: &[u8]) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = sps.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_h264_get_level(
            sps.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get H264 level"))
    }
}

#[doc(alias = "gst_codec_utils_h264_get_level_idc")]
pub fn codec_utils_h264_get_level_idc(level: &str) -> u8 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_codec_utils_h264_get_level_idc(level.to_glib_none().0) }
}

#[doc(alias = "gst_codec_utils_h264_get_profile")]
pub fn codec_utils_h264_get_profile(sps: &[u8]) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = sps.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_h264_get_profile(
            sps.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get H264 profile"))
    }
}

#[doc(alias = "gst_codec_utils_h265_get_level")]
pub fn codec_utils_h265_get_level(
    profile_tier_level: &[u8],
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = profile_tier_level.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_level(
            profile_tier_level.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get H265 level"))
    }
}

#[doc(alias = "gst_codec_utils_h265_get_level_idc")]
pub fn codec_utils_h265_get_level_idc(level: &str) -> u8 {
    assert_initialized_main_thread!();
    unsafe { ffi::gst_codec_utils_h265_get_level_idc(level.to_glib_none().0) }
}

#[doc(alias = "gst_codec_utils_h265_get_profile")]
pub fn codec_utils_h265_get_profile(
    profile_tier_level: &[u8],
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = profile_tier_level.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_profile(
            profile_tier_level.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get H265 profile"))
    }
}

#[doc(alias = "gst_codec_utils_h265_get_tier")]
pub fn codec_utils_h265_get_tier(
    profile_tier_level: &[u8],
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = profile_tier_level.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_tier(
            profile_tier_level.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get H265 tier"))
    }
}

#[doc(alias = "gst_codec_utils_mpeg4video_get_level")]
pub fn codec_utils_mpeg4video_get_level(
    vis_obj_seq: &[u8],
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = vis_obj_seq.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_mpeg4video_get_level(
            vis_obj_seq.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get MPEG4 video level"))
    }
}

#[doc(alias = "gst_codec_utils_mpeg4video_get_profile")]
pub fn codec_utils_mpeg4video_get_profile(
    vis_obj_seq: &[u8],
) -> Result<glib::GString, glib::BoolError> {
    assert_initialized_main_thread!();
    let len = vis_obj_seq.len() as _;
    unsafe {
        Option::<_>::from_glib_none(ffi::gst_codec_utils_mpeg4video_get_profile(
            vis_obj_seq.to_glib_none().0,
            len,
        ))
        .ok_or_else(|| glib::bool_error!("Failed to get MPEG4 video profile"))
    }
}

#[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,
        ))
    }
}

#[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()) }
}

#[doc(alias = "gst_pb_utils_get_element_description")]
pub fn pb_utils_get_element_description(factory_name: &str) -> glib::GString {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_full(ffi::gst_pb_utils_get_element_description(
            factory_name.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_pb_utils_get_sink_description")]
pub fn pb_utils_get_sink_description(protocol: &str) -> glib::GString {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_full(ffi::gst_pb_utils_get_sink_description(
            protocol.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_pb_utils_get_source_description")]
pub fn pb_utils_get_source_description(protocol: &str) -> glib::GString {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_full(ffi::gst_pb_utils_get_source_description(
            protocol.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_plugins_base_version")]
pub fn plugins_base_version() -> (u32, u32, u32, u32) {
    skip_assert_initialized!();
    unsafe {
        let mut major = std::mem::MaybeUninit::uninit();
        let mut minor = std::mem::MaybeUninit::uninit();
        let mut micro = std::mem::MaybeUninit::uninit();
        let mut nano = std::mem::MaybeUninit::uninit();
        ffi::gst_plugins_base_version(
            major.as_mut_ptr(),
            minor.as_mut_ptr(),
            micro.as_mut_ptr(),
            nano.as_mut_ptr(),
        );
        (
            major.assume_init(),
            minor.assume_init(),
            micro.assume_init(),
            nano.assume_init(),
        )
    }
}

#[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()) }
}