mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-19 13:45:32 +00:00
pbutils: Add manual bindings for av1c to/from caps helpers
The main difference is that they consume the Ref version of the Caps/Buffer and output a Result instead of an Option Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1624>
This commit is contained in:
parent
6662a3b95f
commit
3388bbe9a4
3 changed files with 41 additions and 24 deletions
|
@ -231,6 +231,17 @@ status = "generate"
|
|||
name = "plugins_base_version"
|
||||
assertion = "skip"
|
||||
|
||||
# Needs special handle for buffer ref
|
||||
[[object.function]]
|
||||
name = "codec_utils_av1_create_caps_from_av1c"
|
||||
manual = true
|
||||
|
||||
# Needs special handle for caps ref
|
||||
[[object.function]]
|
||||
name = "codec_utils_av1_create_av1c_from_caps"
|
||||
manual = true
|
||||
|
||||
|
||||
[[object]]
|
||||
name = "GstPbutils.Discoverer"
|
||||
status = "generate"
|
||||
|
|
|
@ -58,30 +58,6 @@ pub fn codec_utils_aac_get_sample_rate_from_index(sr_idx: u32) -> u32 {
|
|||
unsafe { ffi::gst_codec_utils_aac_get_sample_rate_from_index(sr_idx) }
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_codec_utils_av1_create_av1c_from_caps")]
|
||||
pub fn codec_utils_av1_create_av1c_from_caps(caps: &gst::Caps) -> gst::Buffer {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_codec_utils_av1_create_av1c_from_caps(
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_codec_utils_av1_create_caps_from_av1c")]
|
||||
pub fn codec_utils_av1_create_caps_from_av1c(av1c: &gst::Buffer) -> gst::Caps {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_codec_utils_av1_create_caps_from_av1c(
|
||||
av1c.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_codec_utils_av1_get_level")]
|
||||
|
|
|
@ -440,3 +440,33 @@ pub fn pb_utils_get_file_extension_from_caps(caps: &gst::CapsRef) -> Option<glib
|
|||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_codec_utils_av1_create_caps_from_av1c")]
|
||||
pub fn codec_utils_av1_create_caps_from_av1c(
|
||||
av1c: &gst::BufferRef,
|
||||
) -> Result<gst::Caps, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_av1_create_caps_from_av1c(
|
||||
mut_override(av1c.as_ptr()),
|
||||
))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create caps from AV1C header"))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_codec_utils_av1_create_av1c_from_caps")]
|
||||
pub fn codec_utils_av1_create_av1c_from_caps(
|
||||
caps: &gst::CapsRef,
|
||||
) -> Result<gst::Buffer, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_av1_create_av1c_from_caps(
|
||||
mut_override(caps.as_ptr()),
|
||||
))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create AV1C header from caps"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue