// 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::{TagLicenseFlags, ffi};
use glib::translate::*;

#[doc(alias = "gst_tag_from_id3_tag")]
pub fn tag_from_id3_tag(id3_tag: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_from_id3_tag(id3_tag.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_from_id3_user_tag")]
pub fn tag_from_id3_user_tag(type_: &str, id3_user_tag: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_none(ffi::gst_tag_from_id3_user_tag(
            type_.to_glib_none().0,
            id3_user_tag.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_tag_from_vorbis_tag")]
pub fn tag_from_vorbis_tag(vorbis_tag: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_from_vorbis_tag(vorbis_tag.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_get_license_description")]
pub fn tag_get_license_description(license_ref: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_none(ffi::gst_tag_get_license_description(
            license_ref.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_tag_get_license_flags")]
pub fn tag_get_license_flags(license_ref: &str) -> TagLicenseFlags {
    assert_initialized_main_thread!();
    unsafe { from_glib(ffi::gst_tag_get_license_flags(license_ref.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_get_license_jurisdiction")]
pub fn tag_get_license_jurisdiction(license_ref: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_none(ffi::gst_tag_get_license_jurisdiction(
            license_ref.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_tag_get_license_nick")]
pub fn tag_get_license_nick(license_ref: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_get_license_nick(license_ref.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_get_license_title")]
pub fn tag_get_license_title(license_ref: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_get_license_title(license_ref.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_get_license_version")]
pub fn tag_get_license_version(license_ref: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe {
        from_glib_none(ffi::gst_tag_get_license_version(
            license_ref.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_tag_get_licenses")]
pub fn tag_get_licenses() -> Vec<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_tag_get_licenses()) }
}

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

#[doc(alias = "gst_tag_id3_genre_get")]
pub fn tag_id3_genre_get(id: u32) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_id3_genre_get(id)) }
}

#[doc(alias = "gst_tag_parse_extended_comment")]
pub fn tag_parse_extended_comment(
    ext_comment: &str,
    fail_if_no_key: bool,
) -> Option<(Option<glib::GString>, Option<glib::GString>, glib::GString)> {
    assert_initialized_main_thread!();
    unsafe {
        let mut key = std::ptr::null_mut();
        let mut lang = std::ptr::null_mut();
        let mut value = std::ptr::null_mut();
        let ret = from_glib(ffi::gst_tag_parse_extended_comment(
            ext_comment.to_glib_none().0,
            &mut key,
            &mut lang,
            &mut value,
            fail_if_no_key.into_glib(),
        ));
        if ret {
            Some((
                from_glib_full(key),
                from_glib_full(lang),
                from_glib_full(value),
            ))
        } else {
            None
        }
    }
}

#[doc(alias = "gst_tag_to_id3_tag")]
pub fn tag_to_id3_tag(gst_tag: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_to_id3_tag(gst_tag.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_to_vorbis_tag")]
pub fn tag_to_vorbis_tag(gst_tag: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_none(ffi::gst_tag_to_vorbis_tag(gst_tag.to_glib_none().0)) }
}

#[doc(alias = "gst_tag_xmp_list_schemas")]
pub fn tag_xmp_list_schemas() -> Vec<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_tag_xmp_list_schemas()) }
}
