Skip to main content

gstreamer_tag/auto/
functions.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{TagLicenseFlags, ffi};
7use glib::translate::*;
8
9/// Looks up the GStreamer tag for a ID3v2 tag.
10/// ## `id3_tag`
11/// ID3v2 tag to convert to GStreamer tag
12///
13/// # Returns
14///
15/// The corresponding GStreamer tag or NULL if none exists.
16#[doc(alias = "gst_tag_from_id3_tag")]
17pub fn tag_from_id3_tag(id3_tag: &str) -> Option<glib::GString> {
18    assert_initialized_main_thread!();
19    unsafe { from_glib_none(ffi::gst_tag_from_id3_tag(id3_tag.to_glib_none().0)) }
20}
21
22/// Looks up the GStreamer tag for an ID3v2 user tag (e.g. description in
23/// TXXX frame or owner in UFID frame).
24/// ## `type_`
25/// the type of ID3v2 user tag (e.g. "TXXX" or "UDIF")
26/// ## `id3_user_tag`
27/// ID3v2 user tag to convert to GStreamer tag
28///
29/// # Returns
30///
31/// The corresponding GStreamer tag or NULL if none exists.
32#[doc(alias = "gst_tag_from_id3_user_tag")]
33pub fn tag_from_id3_user_tag(type_: &str, id3_user_tag: &str) -> Option<glib::GString> {
34    assert_initialized_main_thread!();
35    unsafe {
36        from_glib_none(ffi::gst_tag_from_id3_user_tag(
37            type_.to_glib_none().0,
38            id3_user_tag.to_glib_none().0,
39        ))
40    }
41}
42
43/// Looks up the GStreamer tag for a vorbiscomment tag.
44/// ## `vorbis_tag`
45/// vorbiscomment tag to convert to GStreamer tag
46///
47/// # Returns
48///
49/// The corresponding GStreamer tag or NULL if none exists.
50#[doc(alias = "gst_tag_from_vorbis_tag")]
51pub fn tag_from_vorbis_tag(vorbis_tag: &str) -> Option<glib::GString> {
52    assert_initialized_main_thread!();
53    unsafe { from_glib_none(ffi::gst_tag_from_vorbis_tag(vorbis_tag.to_glib_none().0)) }
54}
55
56/// Get the description of a license, which is a translated description
57/// of the license's main features.
58/// ## `license_ref`
59/// a license reference string in form of a URI,
60///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
61///
62/// # Returns
63///
64/// the description of the license, or NULL if the license is unknown
65///  or a description is not available.
66#[doc(alias = "gst_tag_get_license_description")]
67pub fn tag_get_license_description(license_ref: &str) -> Option<glib::GString> {
68    assert_initialized_main_thread!();
69    unsafe {
70        from_glib_none(ffi::gst_tag_get_license_description(
71            license_ref.to_glib_none().0,
72        ))
73    }
74}
75
76/// Get the flags of a license, which describe most of the features of
77/// a license in their most general form.
78/// ## `license_ref`
79/// a license reference string in form of a URI,
80///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
81///
82/// # Returns
83///
84/// the flags of the license, or 0 if the license is unknown
85#[doc(alias = "gst_tag_get_license_flags")]
86pub fn tag_get_license_flags(license_ref: &str) -> TagLicenseFlags {
87    assert_initialized_main_thread!();
88    unsafe { from_glib(ffi::gst_tag_get_license_flags(license_ref.to_glib_none().0)) }
89}
90
91/// Get the jurisdiction code of a license. This is usually a two-letter
92/// ISO 3166-1 alpha-2 code, but there is also the special case of Scotland,
93/// for which no code exists and which is thus represented as "scotland".
94///
95/// Known jurisdictions: ar, at, au, be, bg, br, ca, ch, cl, cn, co, de,
96/// dk, es, fi, fr, hr, hu, il, in, it, jp, kr, mk, mt, mx, my, nl, pe, pl,
97/// pt, scotland, se, si, tw, uk, us, za.
98/// ## `license_ref`
99/// a license reference string in form of a URI,
100///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
101///
102/// # Returns
103///
104/// the jurisdiction code of the license, or NULL if the license is
105///  unknown or is not specific to a particular jurisdiction.
106#[doc(alias = "gst_tag_get_license_jurisdiction")]
107pub fn tag_get_license_jurisdiction(license_ref: &str) -> Option<glib::GString> {
108    assert_initialized_main_thread!();
109    unsafe {
110        from_glib_none(ffi::gst_tag_get_license_jurisdiction(
111            license_ref.to_glib_none().0,
112        ))
113    }
114}
115
116/// Get the nick name of a license, which is a short (untranslated) string
117/// such as e.g. "CC BY-NC-ND 2.0 UK".
118/// ## `license_ref`
119/// a license reference string in form of a URI,
120///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
121///
122/// # Returns
123///
124/// the nick name of the license, or NULL if the license is unknown
125#[doc(alias = "gst_tag_get_license_nick")]
126pub fn tag_get_license_nick(license_ref: &str) -> Option<glib::GString> {
127    assert_initialized_main_thread!();
128    unsafe { from_glib_none(ffi::gst_tag_get_license_nick(license_ref.to_glib_none().0)) }
129}
130
131/// Get the title of a license, which is a short translated description
132/// of the license's features (generally not very pretty though).
133/// ## `license_ref`
134/// a license reference string in form of a URI,
135///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
136///
137/// # Returns
138///
139/// the title of the license, or NULL if the license is unknown or
140///  no title is available.
141#[doc(alias = "gst_tag_get_license_title")]
142pub fn tag_get_license_title(license_ref: &str) -> Option<glib::GString> {
143    assert_initialized_main_thread!();
144    unsafe { from_glib_none(ffi::gst_tag_get_license_title(license_ref.to_glib_none().0)) }
145}
146
147/// Get the version of a license.
148/// ## `license_ref`
149/// a license reference string in form of a URI,
150///  e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
151///
152/// # Returns
153///
154/// the version of the license, or NULL if the license is not known or
155///  has no version
156#[doc(alias = "gst_tag_get_license_version")]
157pub fn tag_get_license_version(license_ref: &str) -> Option<glib::GString> {
158    assert_initialized_main_thread!();
159    unsafe {
160        from_glib_none(ffi::gst_tag_get_license_version(
161            license_ref.to_glib_none().0,
162        ))
163    }
164}
165
166/// Returns a list of known license references (in form of URIs). This is
167/// useful for UIs to build a list of available licenses for tagging purposes
168/// (e.g. to tag an audio track appropriately in a video or audio editor, or
169/// an image in a camera application).
170///
171/// # Returns
172///
173/// NULL-terminated array of license strings. Free
174///  with `g_strfreev()` when no longer needed.
175#[doc(alias = "gst_tag_get_licenses")]
176pub fn tag_get_licenses() -> Vec<glib::GString> {
177    assert_initialized_main_thread!();
178    unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_tag_get_licenses()) }
179}
180
181/// Gets the number of ID3v1 genres that can be identified. Winamp genres are
182/// included.
183///
184/// # Returns
185///
186/// the number of ID3v1 genres that can be identified
187#[doc(alias = "gst_tag_id3_genre_count")]
188pub fn tag_id3_genre_count() -> u32 {
189    assert_initialized_main_thread!();
190    unsafe { ffi::gst_tag_id3_genre_count() }
191}
192
193/// Gets the ID3v1 genre name for a given ID.
194/// ## `id`
195/// ID of genre to query
196///
197/// # Returns
198///
199/// the genre or NULL if no genre is associated with that ID.
200#[doc(alias = "gst_tag_id3_genre_get")]
201pub fn tag_id3_genre_get(id: u32) -> Option<glib::GString> {
202    assert_initialized_main_thread!();
203    unsafe { from_glib_none(ffi::gst_tag_id3_genre_get(id)) }
204}
205
206/// Convenience function to parse a GST_TAG_EXTENDED_COMMENT string and
207/// separate it into its components.
208///
209/// If successful, `key`, `lang` and/or `value` will be set to newly allocated
210/// strings that you need to free with `g_free()` when done. `key` and `lang`
211/// may also be set to NULL by this function if there is no key or no language
212/// code in the extended comment string.
213/// ## `ext_comment`
214/// an extended comment string, see `GST_TAG_EXTENDED_COMMENT`
215/// ## `fail_if_no_key`
216/// whether to fail if strings are not in key=value form
217///
218/// # Returns
219///
220/// TRUE if the string could be parsed, otherwise FALSE
221///
222/// ## `key`
223///
224///  return location for the comment description key, or NULL
225///
226/// ## `lang`
227///
228///  return location for the comment ISO-639 language code, or NULL
229///
230/// ## `value`
231/// return location for the actual comment string, or NULL
232#[doc(alias = "gst_tag_parse_extended_comment")]
233pub fn tag_parse_extended_comment(
234    ext_comment: &str,
235    fail_if_no_key: bool,
236) -> Option<(Option<glib::GString>, Option<glib::GString>, glib::GString)> {
237    assert_initialized_main_thread!();
238    unsafe {
239        let mut key = std::ptr::null_mut();
240        let mut lang = std::ptr::null_mut();
241        let mut value = std::ptr::null_mut();
242        let ret = from_glib(ffi::gst_tag_parse_extended_comment(
243            ext_comment.to_glib_none().0,
244            &mut key,
245            &mut lang,
246            &mut value,
247            fail_if_no_key.into_glib(),
248        ));
249        if ret {
250            Some((
251                from_glib_full(key),
252                from_glib_full(lang),
253                from_glib_full(value),
254            ))
255        } else {
256            None
257        }
258    }
259}
260
261/// Looks up the ID3v2 tag for a GStreamer tag.
262/// ## `gst_tag`
263/// GStreamer tag to convert to vorbiscomment tag
264///
265/// # Returns
266///
267/// The corresponding ID3v2 tag or NULL if none exists.
268#[doc(alias = "gst_tag_to_id3_tag")]
269pub fn tag_to_id3_tag(gst_tag: &str) -> Option<glib::GString> {
270    assert_initialized_main_thread!();
271    unsafe { from_glib_none(ffi::gst_tag_to_id3_tag(gst_tag.to_glib_none().0)) }
272}
273
274/// Looks up the vorbiscomment tag for a GStreamer tag.
275/// ## `gst_tag`
276/// GStreamer tag to convert to vorbiscomment tag
277///
278/// # Returns
279///
280/// The corresponding vorbiscomment tag or NULL if none exists.
281#[doc(alias = "gst_tag_to_vorbis_tag")]
282pub fn tag_to_vorbis_tag(gst_tag: &str) -> Option<glib::GString> {
283    assert_initialized_main_thread!();
284    unsafe { from_glib_none(ffi::gst_tag_to_vorbis_tag(gst_tag.to_glib_none().0)) }
285}
286
287/// Gets the list of supported schemas in the xmp lib
288///
289/// # Returns
290///
291/// a [`None`] terminated array of strings with the
292///  schema names
293#[doc(alias = "gst_tag_xmp_list_schemas")]
294pub fn tag_xmp_list_schemas() -> Vec<glib::GString> {
295    assert_initialized_main_thread!();
296    unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_tag_xmp_list_schemas()) }
297}