libappstream 0.4.0

Rust bindings for appstream
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::{ffi, VideoCodecKind, VideoContainerKind};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "AsVideo")]
    pub struct Video(Object<ffi::AsVideo, ffi::AsVideoClass>);

    match fn {
        type_ => || ffi::as_video_get_type(),
    }
}

impl Video {
    pub const NONE: Option<&'static Video> = None;

    #[doc(alias = "as_video_new")]
    pub fn new() -> Video {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::as_video_new()) }
    }
}

impl Default for Video {
    fn default() -> Self {
        Self::new()
    }
}

pub trait VideoExt: IsA<Video> + 'static {
    #[doc(alias = "as_video_get_codec_kind")]
    #[doc(alias = "get_codec_kind")]
    fn codec_kind(&self) -> VideoCodecKind {
        unsafe { from_glib(ffi::as_video_get_codec_kind(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_video_get_container_kind")]
    #[doc(alias = "get_container_kind")]
    fn container_kind(&self) -> VideoContainerKind {
        unsafe {
            from_glib(ffi::as_video_get_container_kind(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "as_video_get_height")]
    #[doc(alias = "get_height")]
    fn height(&self) -> u32 {
        unsafe { ffi::as_video_get_height(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "as_video_get_locale")]
    #[doc(alias = "get_locale")]
    fn locale(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::as_video_get_locale(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_video_get_url")]
    #[doc(alias = "get_url")]
    fn url(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::as_video_get_url(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_video_get_width")]
    #[doc(alias = "get_width")]
    fn width(&self) -> u32 {
        unsafe { ffi::as_video_get_width(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "as_video_set_codec_kind")]
    fn set_codec_kind(&self, kind: VideoCodecKind) {
        unsafe {
            ffi::as_video_set_codec_kind(self.as_ref().to_glib_none().0, kind.into_glib());
        }
    }

    #[doc(alias = "as_video_set_container_kind")]
    fn set_container_kind(&self, kind: VideoContainerKind) {
        unsafe {
            ffi::as_video_set_container_kind(self.as_ref().to_glib_none().0, kind.into_glib());
        }
    }

    #[doc(alias = "as_video_set_height")]
    fn set_height(&self, height: u32) {
        unsafe {
            ffi::as_video_set_height(self.as_ref().to_glib_none().0, height);
        }
    }

    #[doc(alias = "as_video_set_locale")]
    fn set_locale(&self, locale: &str) {
        unsafe {
            ffi::as_video_set_locale(self.as_ref().to_glib_none().0, locale.to_glib_none().0);
        }
    }

    #[doc(alias = "as_video_set_url")]
    fn set_url(&self, url: &str) {
        unsafe {
            ffi::as_video_set_url(self.as_ref().to_glib_none().0, url.to_glib_none().0);
        }
    }

    #[doc(alias = "as_video_set_width")]
    fn set_width(&self, width: u32) {
        unsafe {
            ffi::as_video_set_width(self.as_ref().to_glib_none().0, width);
        }
    }
}

impl<O: IsA<Video>> VideoExt for O {}