2019-05-25 08:11:06 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2021-04-01 13:58:41 +00:00
|
|
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
2019-05-25 08:11:06 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-11-22 09:50:37 +00:00
|
|
|
use crate::VideoCodecFrame;
|
2019-05-25 08:11:06 +00:00
|
|
|
use glib::object::Cast;
|
|
|
|
use glib::object::IsA;
|
|
|
|
use glib::signal::connect_raw;
|
2019-06-18 10:12:00 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2019-05-25 08:11:06 +00:00
|
|
|
use glib::translate::*;
|
2019-06-18 10:12:00 +00:00
|
|
|
use glib::StaticType;
|
2021-04-19 16:24:43 +00:00
|
|
|
use glib::ToValue;
|
2019-05-25 08:11:06 +00:00
|
|
|
use std::boxed::Box as Box_;
|
2020-04-13 16:11:33 +00:00
|
|
|
use std::mem::transmute;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::wrapper! {
|
2021-06-02 07:47:51 +00:00
|
|
|
#[doc(alias = "GstVideoEncoder")]
|
2020-11-22 09:50:37 +00:00
|
|
|
pub struct VideoEncoder(Object<ffi::GstVideoEncoder, ffi::GstVideoEncoderClass>) @extends gst::Element, gst::Object;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
|
|
|
match fn {
|
2021-04-19 19:55:01 +00:00
|
|
|
type_ => || ffi::gst_video_encoder_get_type(),
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for VideoEncoder {}
|
|
|
|
unsafe impl Sync for VideoEncoder {}
|
|
|
|
|
|
|
|
pub const NONE_VIDEO_ENCODER: Option<&VideoEncoder> = None;
|
|
|
|
|
|
|
|
pub trait VideoEncoderExt: 'static {
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_allocate_output_buffer")]
|
2019-12-17 19:00:42 +00:00
|
|
|
fn allocate_output_buffer(&self, size: usize) -> Result<gst::Buffer, glib::BoolError>;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_get_max_encode_time")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_max_encode_time")]
|
2021-04-19 20:13:58 +00:00
|
|
|
fn max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_get_min_force_key_unit_interval")]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "get_min_force_key_unit_interval")]
|
2021-04-05 10:48:30 +00:00
|
|
|
fn min_force_key_unit_interval(&self) -> Option<gst::ClockTime>;
|
2020-07-06 08:37:14 +00:00
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_is_qos_enabled")]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn is_qos_enabled(&self) -> bool;
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_merge_tags")]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode);
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_proxy_getcaps")]
|
2019-09-14 08:05:55 +00:00
|
|
|
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_set_headers")]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn set_headers(&self, headers: &[&gst::Buffer]);
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_set_min_force_key_unit_interval")]
|
2021-04-05 10:48:30 +00:00
|
|
|
fn set_min_force_key_unit_interval(&self, interval: impl Into<Option<gst::ClockTime>>);
|
2020-07-06 08:37:14 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_set_min_pts")]
|
2021-04-05 10:48:30 +00:00
|
|
|
fn set_min_pts(&self, min_pts: impl Into<Option<gst::ClockTime>>);
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_video_encoder_set_qos_enabled")]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn set_qos_enabled(&self, enabled: bool);
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn is_qos(&self) -> bool;
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn set_qos(&self, qos: bool);
|
2019-05-25 08:11:06 +00:00
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "min-force-key-unit-interval")]
|
|
|
|
fn connect_min_force_key_unit_interval_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
2020-07-06 08:37:14 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId;
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "qos")]
|
|
|
|
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<VideoEncoder>> VideoEncoderExt for O {
|
2019-12-17 19:00:42 +00:00
|
|
|
fn allocate_output_buffer(&self, size: usize) -> Result<gst::Buffer, glib::BoolError> {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
Option::<_>::from_glib_full(ffi::gst_video_encoder_allocate_output_buffer(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
size,
|
|
|
|
))
|
2020-12-17 22:34:53 +00:00
|
|
|
.ok_or_else(|| glib::bool_error!("Failed to allocate output buffer"))
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2021-04-19 20:13:58 +00:00
|
|
|
fn max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
ffi::gst_video_encoder_get_max_encode_time(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
frame.to_glib_none().0,
|
|
|
|
)
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2021-04-05 10:48:30 +00:00
|
|
|
fn min_force_key_unit_interval(&self) -> Option<gst::ClockTime> {
|
2020-07-06 08:37:14 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
from_glib(ffi::gst_video_encoder_get_min_force_key_unit_interval(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
2020-07-06 08:37:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn is_qos_enabled(&self) -> bool {
|
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
from_glib(ffi::gst_video_encoder_is_qos_enabled(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
))
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
|
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
ffi::gst_video_encoder_merge_tags(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
tags.to_glib_none().0,
|
2021-04-27 15:10:39 +00:00
|
|
|
mode.into_glib(),
|
2019-06-18 10:12:00 +00:00
|
|
|
);
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-14 08:05:55 +00:00
|
|
|
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
from_glib_full(ffi::gst_video_encoder_proxy_getcaps(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
caps.to_glib_none().0,
|
|
|
|
filter.to_glib_none().0,
|
|
|
|
))
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_headers(&self, headers: &[&gst::Buffer]) {
|
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
ffi::gst_video_encoder_set_headers(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
headers.to_glib_full(),
|
|
|
|
);
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2021-04-05 10:48:30 +00:00
|
|
|
fn set_min_force_key_unit_interval(&self, interval: impl Into<Option<gst::ClockTime>>) {
|
2020-07-06 08:37:14 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
ffi::gst_video_encoder_set_min_force_key_unit_interval(
|
2020-07-06 08:37:14 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
2021-04-05 10:48:30 +00:00
|
|
|
interval.into().into_glib(),
|
2020-07-06 08:37:14 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-05 10:48:30 +00:00
|
|
|
fn set_min_pts(&self, min_pts: impl Into<Option<gst::ClockTime>>) {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2021-04-05 10:48:30 +00:00
|
|
|
ffi::gst_video_encoder_set_min_pts(
|
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
min_pts.into().into_glib(),
|
|
|
|
);
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2019-05-25 08:11:06 +00:00
|
|
|
fn set_qos_enabled(&self, enabled: bool) {
|
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
ffi::gst_video_encoder_set_qos_enabled(
|
2019-06-18 10:12:00 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
2021-04-27 15:10:39 +00:00
|
|
|
enabled.into_glib(),
|
2019-06-18 10:12:00 +00:00
|
|
|
);
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn is_qos(&self) -> bool {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2020-11-27 13:37:24 +00:00
|
|
|
let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
|
2020-11-22 09:50:37 +00:00
|
|
|
glib::gobject_ffi::g_object_get_property(
|
|
|
|
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
|
2019-06-18 10:12:00 +00:00
|
|
|
b"qos\0".as_ptr() as *const _,
|
|
|
|
value.to_glib_none_mut().0,
|
|
|
|
);
|
2021-04-19 16:24:43 +00:00
|
|
|
value.get().expect("Return Value for property `qos` getter")
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
fn set_qos(&self, qos: bool) {
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
2020-11-22 09:50:37 +00:00
|
|
|
glib::gobject_ffi::g_object_set_property(
|
|
|
|
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
|
2019-06-18 10:12:00 +00:00
|
|
|
b"qos\0".as_ptr() as *const _,
|
2021-04-19 16:24:43 +00:00
|
|
|
qos.to_value().to_glib_none().0,
|
2019-06-18 10:12:00 +00:00
|
|
|
);
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:24 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2021-05-03 18:35:37 +00:00
|
|
|
fn connect_min_force_key_unit_interval_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
2020-07-06 08:37:14 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn notify_min_force_key_unit_interval_trampoline<
|
2021-05-26 22:02:42 +00:00
|
|
|
P: IsA<VideoEncoder>,
|
2020-07-06 08:37:14 +00:00
|
|
|
F: Fn(&P) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-22 09:50:37 +00:00
|
|
|
this: *mut ffi::GstVideoEncoder,
|
|
|
|
_param_spec: glib::ffi::gpointer,
|
|
|
|
f: glib::ffi::gpointer,
|
2021-05-26 22:02:42 +00:00
|
|
|
) {
|
2020-07-06 08:37:14 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
2021-06-21 21:07:45 +00:00
|
|
|
f(VideoEncoder::from_glib_borrow(this).unsafe_cast_ref())
|
2020-07-06 08:37:14 +00:00
|
|
|
}
|
|
|
|
unsafe {
|
|
|
|
let f: Box_<F> = Box_::new(f);
|
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"notify::min-force-key-unit-interval\0".as_ptr() as *const _,
|
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
notify_min_force_key_unit_interval_trampoline::<Self, F> as *const (),
|
|
|
|
)),
|
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2021-05-26 22:02:42 +00:00
|
|
|
unsafe extern "C" fn notify_qos_trampoline<
|
|
|
|
P: IsA<VideoEncoder>,
|
|
|
|
F: Fn(&P) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-22 09:50:37 +00:00
|
|
|
this: *mut ffi::GstVideoEncoder,
|
|
|
|
_param_spec: glib::ffi::gpointer,
|
|
|
|
f: glib::ffi::gpointer,
|
2021-05-26 22:02:42 +00:00
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
2021-06-21 21:07:45 +00:00
|
|
|
f(VideoEncoder::from_glib_borrow(this).unsafe_cast_ref())
|
2019-06-18 10:10:46 +00:00
|
|
|
}
|
2019-05-25 08:11:06 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"notify::qos\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
notify_qos_trampoline::<Self, F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
2019-05-25 08:11:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|