forked from mirrors/gstreamer-rs
Update everything for glib macro renamings
This commit is contained in:
parent
d0b0006d27
commit
ce1148b474
70 changed files with 234 additions and 279 deletions
|
@ -9,9 +9,6 @@
|
|||
|
||||
use gst_rtsp_server::prelude::*;
|
||||
|
||||
use glib::glib_object_subclass;
|
||||
use glib::glib_wrapper;
|
||||
|
||||
use anyhow::Error;
|
||||
use derive_more::{Display, Error};
|
||||
|
||||
|
@ -104,7 +101,7 @@ mod media_factory {
|
|||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
// This macro provides some boilerplate
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
// Called when a new instance is to be created. We need to return an instance
|
||||
// of our struct here.
|
||||
|
@ -156,7 +153,7 @@ mod media_factory {
|
|||
|
||||
// This here defines the public interface of our factory and implements
|
||||
// the corresponding traits so that it behaves like any other RTSPMediaFactory
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Factory(ObjectSubclass<imp::Factory>) @extends gst_rtsp_server::RTSPMediaFactory;
|
||||
}
|
||||
|
||||
|
@ -174,8 +171,6 @@ mod media_factory {
|
|||
|
||||
// Our custom media subclass that adds a custom attribute to the SDP returned by DESCRIBE
|
||||
mod media {
|
||||
use super::*;
|
||||
|
||||
use glib::subclass;
|
||||
use glib::subclass::prelude::*;
|
||||
|
||||
|
@ -199,7 +194,7 @@ mod media {
|
|||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
// This macro provides some boilerplate
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
// Called when a new instance is to be created. We need to return an instance
|
||||
// of our struct here.
|
||||
|
@ -230,7 +225,7 @@ mod media {
|
|||
|
||||
// This here defines the public interface of our factory and implements
|
||||
// the corresponding traits so that it behaves like any other RTSPMedia
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Media(ObjectSubclass<imp::Media>) @extends gst_rtsp_server::RTSPMedia;
|
||||
}
|
||||
|
||||
|
@ -267,7 +262,7 @@ mod server {
|
|||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
// This macro provides some boilerplate
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
// Called when a new instance is to be created. We need to return an instance
|
||||
// of our struct here.
|
||||
|
@ -302,7 +297,7 @@ mod server {
|
|||
|
||||
// This here defines the public interface of our factory and implements
|
||||
// the corresponding traits so that it behaves like any other RTSPServer
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Server(ObjectSubclass<imp::Server>) @extends gst_rtsp_server::RTSPServer;
|
||||
}
|
||||
|
||||
|
@ -320,8 +315,6 @@ mod server {
|
|||
|
||||
// Our custom RTSP client subclass.
|
||||
mod client {
|
||||
use super::*;
|
||||
|
||||
use glib::subclass;
|
||||
use glib::subclass::prelude::*;
|
||||
|
||||
|
@ -345,7 +338,7 @@ mod client {
|
|||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
// This macro provides some boilerplate
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
// Called when a new instance is to be created. We need to return an instance
|
||||
// of our struct here.
|
||||
|
@ -368,7 +361,7 @@ mod client {
|
|||
|
||||
// This here defines the public interface of our factory and implements
|
||||
// the corresponding traits so that it behaves like any other RTSPClient
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Client(ObjectSubclass<imp::Client>) @extends gst_rtsp_server::RTSPClient;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
// Our filter can only handle F32 mono and acts as a FIR filter. The filter impulse response /
|
||||
// coefficients are provided via Rust API on the filter as a Vec<f32>.
|
||||
|
||||
use glib::glib_object_subclass;
|
||||
use glib::glib_wrapper;
|
||||
|
||||
use gst::gst_element_error;
|
||||
use gst::gst_info;
|
||||
use gst::gst_trace;
|
||||
|
@ -68,7 +65,7 @@ mod fir_filter {
|
|||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
// This macro provides some boilerplate
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
// Called when a new instance is to be created. We need to return an instance
|
||||
// of our struct here.
|
||||
|
@ -245,7 +242,7 @@ mod fir_filter {
|
|||
|
||||
// This here defines the public interface of our element and implements
|
||||
// the corresponding traits so that it behaves like any other gst::Element
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct FirFilter(ObjectSubclass<imp::FirFilter>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ impl<T> AudioBuffer<T> {
|
|||
|
||||
pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ impl AudioBuffer<Writable> {
|
|||
|
||||
pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ impl<T> AudioBufferRef<T> {
|
|||
|
||||
pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ impl<'a> AudioBufferRef<&'a gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map AudioBuffer"))
|
||||
Err(glib::bool_error!("Failed to map AudioBuffer"))
|
||||
} else {
|
||||
let info = crate::AudioInfo::from_glib_none(
|
||||
&audio_buffer.info as *const _ as *mut ffi::GstAudioInfo,
|
||||
|
@ -444,7 +444,7 @@ impl<'a> AudioBufferRef<&'a mut gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map AudioBuffer"))
|
||||
Err(glib::bool_error!("Failed to map AudioBuffer"))
|
||||
} else {
|
||||
let info = crate::AudioInfo::from_glib_none(
|
||||
&audio_buffer.info as *const _ as *mut ffi::GstAudioInfo,
|
||||
|
@ -465,7 +465,7 @@ impl<'a> AudioBufferRef<&'a mut gst::BufferRef> {
|
|||
|
||||
pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ impl AudioChannelPosition {
|
|||
|
||||
let len = positions.len();
|
||||
if len > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| {
|
||||
|
@ -46,7 +46,7 @@ impl AudioChannelPosition {
|
|||
if valid {
|
||||
Ok(mask.assume_init())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Couldn't convert channel positions to mask"
|
||||
))
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl AudioChannelPosition {
|
|||
assert_initialized_main_thread!();
|
||||
|
||||
if positions.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let len = positions.len();
|
||||
|
@ -80,7 +80,7 @@ impl AudioChannelPosition {
|
|||
}
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Couldn't convert channel positions to mask",
|
||||
))
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ impl AudioChannelPosition {
|
|||
assert_initialized_main_thread!();
|
||||
|
||||
if positions.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let len = positions.len();
|
||||
|
@ -117,7 +117,7 @@ impl AudioChannelPosition {
|
|||
}
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Couldn't convert channel positions to mask",
|
||||
))
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ pub fn buffer_reorder_channels(
|
|||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let from_len = from.len();
|
||||
|
@ -203,7 +203,7 @@ pub fn buffer_reorder_channels(
|
|||
if valid {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to reorder channels"))
|
||||
Err(glib::bool_error!("Failed to reorder channels"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ pub fn reorder_channels(
|
|||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let from_len = from.len();
|
||||
|
@ -253,7 +253,7 @@ pub fn reorder_channels(
|
|||
if valid {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to reorder channels"))
|
||||
Err(glib::bool_error!("Failed to reorder channels"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ pub fn get_channel_reorder_map(
|
|||
assert_initialized_main_thread!();
|
||||
|
||||
if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid number of channels"));
|
||||
return Err(glib::bool_error!("Invalid number of channels"));
|
||||
}
|
||||
|
||||
let from_len = from.len();
|
||||
|
@ -303,6 +303,6 @@ pub fn get_channel_reorder_map(
|
|||
}
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to reorder channels"))
|
||||
Err(glib::bool_error!("Failed to reorder channels"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ impl str::FromStr for crate::AudioFormat {
|
|||
|
||||
let fmt = Self::from_string(s);
|
||||
if fmt == Self::Unknown {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Failed to parse audio format from string"
|
||||
))
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
|
||||
let positions = if let Some(p) = self.positions {
|
||||
if p.len() != self.channels as usize || p.len() > 64 {
|
||||
return Err(glib::glib_bool_error!("Invalid positions length"));
|
||||
return Err(glib::bool_error!("Invalid positions length"));
|
||||
}
|
||||
|
||||
let positions: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| {
|
||||
|
@ -58,7 +58,7 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
true.to_glib(),
|
||||
));
|
||||
if !valid {
|
||||
return Err(glib::glib_bool_error!("channel positions are invalid"));
|
||||
return Err(glib::bool_error!("channel positions are invalid"));
|
||||
}
|
||||
|
||||
Some(positions)
|
||||
|
@ -82,7 +82,7 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
let mut info = info.assume_init();
|
||||
|
||||
if info.finfo.is_null() || info.rate <= 0 || info.channels <= 0 {
|
||||
return Err(glib::glib_bool_error!("Failed to build AudioInfo"));
|
||||
return Err(glib::bool_error!("Failed to build AudioInfo"));
|
||||
}
|
||||
|
||||
if let Some(flags) = self.flags {
|
||||
|
@ -155,9 +155,7 @@ impl AudioInfo {
|
|||
let positions = array_init::array_init(|i| from_glib(info.position[i]));
|
||||
Ok(AudioInfo(info, positions))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to create AudioInfo from caps"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to create AudioInfo from caps"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,9 +165,7 @@ impl AudioInfo {
|
|||
let result = from_glib_full(ffi::gst_audio_info_to_caps(&self.0));
|
||||
match result {
|
||||
Some(c) => Ok(c),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
"Failed to create caps from AudioInfo"
|
||||
)),
|
||||
None => Err(glib::bool_error!("Failed to create caps from AudioInfo")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ impl AudioMeta {
|
|||
skip_assert_initialized!();
|
||||
|
||||
if !info.is_valid() {
|
||||
return Err(glib::glib_bool_error!("Invalid audio info"));
|
||||
return Err(glib::bool_error!("Invalid audio info"));
|
||||
}
|
||||
|
||||
if info.rate() == 0
|
||||
|
@ -100,20 +100,17 @@ impl AudioMeta {
|
|||
|| info.format() == crate::AudioFormat::Unknown
|
||||
|| info.format() == crate::AudioFormat::Encoded
|
||||
{
|
||||
return Err(glib::glib_bool_error!(
|
||||
"Unsupported audio format {:?}",
|
||||
info
|
||||
));
|
||||
return Err(glib::bool_error!("Unsupported audio format {:?}", info));
|
||||
}
|
||||
|
||||
if !offsets.is_empty() && info.layout() != crate::AudioLayout::NonInterleaved {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Channel offsets only supported for non-interleaved audio"
|
||||
));
|
||||
}
|
||||
|
||||
if !offsets.is_empty() && offsets.len() != info.channels() as usize {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Number of channel offsets different than number of channels ({} != {})",
|
||||
offsets.len(),
|
||||
info.channels()
|
||||
|
@ -139,7 +136,7 @@ impl AudioMeta {
|
|||
&& !(other_offset + plane_size <= offset
|
||||
|| offset + plane_size <= other_offset)
|
||||
{
|
||||
return Err(glib::glib_bool_error!("Overlapping audio channel offsets: offset {} for channel {} and offset {} for channel {} with a plane size of {}", offset, i, other_offset, j, plane_size));
|
||||
return Err(glib::bool_error!("Overlapping audio channel offsets: offset {} for channel {} and offset {} for channel {} with a plane size of {}", offset, i, other_offset, j, plane_size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +145,7 @@ impl AudioMeta {
|
|||
};
|
||||
|
||||
if max_offset + plane_size > buffer.get_size() {
|
||||
return Err(glib::glib_bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.get_size()));
|
||||
return Err(glib::bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.get_size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +162,7 @@ impl AudioMeta {
|
|||
);
|
||||
|
||||
if meta.is_null() {
|
||||
return Err(glib::glib_bool_error!("Failed to add audio meta"));
|
||||
return Err(glib::bool_error!("Failed to add audio meta"));
|
||||
}
|
||||
|
||||
Ok(Self::from_mut_ptr(buffer, meta))
|
||||
|
|
|
@ -66,7 +66,7 @@ impl Adapter {
|
|||
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_adapter_get_buffer(self.to_glib_none().0, nbytes))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to get buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to get buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ impl Adapter {
|
|||
self.to_glib_none().0,
|
||||
nbytes,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to get buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to get buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ impl Adapter {
|
|||
self.to_glib_none().0,
|
||||
nbytes,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to get buffer list"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to get buffer list"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ impl Adapter {
|
|||
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_adapter_take_buffer(self.to_glib_none().0, nbytes))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to take buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to take buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ impl Adapter {
|
|||
self.to_glib_none().0,
|
||||
nbytes,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to take buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to take buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ impl Adapter {
|
|||
self.to_glib_none().0,
|
||||
nbytes,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to take buffer list"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to take buffer list"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ impl UniqueAdapter {
|
|||
unsafe {
|
||||
let ptr = ffi::gst_adapter_map(self.0.to_glib_none().0, nbytes);
|
||||
if ptr.is_null() {
|
||||
Err(glib::glib_bool_error!("size bytes are not available"))
|
||||
Err(glib::bool_error!("size bytes are not available"))
|
||||
} else {
|
||||
Ok(UniqueAdapterMap(
|
||||
self,
|
||||
|
|
|
@ -105,7 +105,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
|||
from_glib(max_latency),
|
||||
))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to query latency"))
|
||||
Err(glib::bool_error!("Failed to query latency"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
|||
from_glib(max_latency),
|
||||
))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to query latency"))
|
||||
Err(glib::bool_error!("Failed to query latency"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
|||
if ret {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to configure new segment"))
|
||||
Err(glib::bool_error!("Failed to configure new segment"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct FlowCombiner(Shared<ffi::GstFlowCombiner>);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
|||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
Err(glib::glib_bool_error!("No type could be found"))
|
||||
Err(glib::bool_error!("No type could be found"))
|
||||
} else {
|
||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>, R: AsRef<[u
|
|||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
Err(glib::glib_bool_error!("No type could be found"))
|
||||
Err(glib::bool_error!("No type could be found"))
|
||||
} else {
|
||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
|||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
Err(glib::glib_bool_error!("No type could be found"))
|
||||
Err(glib::bool_error!("No type could be found"))
|
||||
} else {
|
||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
|||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
Err(glib::glib_bool_error!("No type could be found"))
|
||||
Err(glib::bool_error!("No type could be found"))
|
||||
} else {
|
||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ impl Harness {
|
|||
|
||||
pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits),
|
||||
"Failed to crank multiple clock waits",
|
||||
)
|
||||
|
@ -166,7 +166,7 @@ impl Harness {
|
|||
|
||||
pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()),
|
||||
"Failed to crank single clock wait",
|
||||
)
|
||||
|
@ -176,7 +176,7 @@ impl Harness {
|
|||
pub fn create_buffer(&mut self, size: usize) -> Result<gst::Buffer, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_create_buffer(self.0.as_ptr(), size))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create new buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create new buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,21 +238,21 @@ impl Harness {
|
|||
pub fn pull(&mut self) -> Result<gst::Buffer, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_pull(self.0.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to pull buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to pull buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pull_event(&mut self) -> Result<gst::Event, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_pull_event(self.0.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to pull event"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to pull event"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pull_upstream_event(&mut self) -> Result<gst::Event, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_pull_upstream_event(self.0.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to pull event"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to pull event"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl Harness {
|
|||
self.0.as_ptr(),
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to push and pull buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to push and pull buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ impl Harness {
|
|||
|
||||
pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()),
|
||||
"Failed to set time",
|
||||
)
|
||||
|
@ -461,7 +461,7 @@ impl Harness {
|
|||
pub fn take_all_data_as_buffer(&mut self) -> Result<gst::Buffer, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_take_all_data_as_buffer(self.0.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to take all data as buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to take all data as buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ impl Harness {
|
|||
pub fn take_all_data_as_bytes(&mut self) -> Result<glib::Bytes, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_harness_take_all_data_as_bytes(self.0.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to take all data as bytes"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to take all data as bytes"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ impl Harness {
|
|||
timeout: u32,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout),
|
||||
"Failed to wait for clock id waits",
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct ControlPoint(Boxed<ffi::GstControlPoint>);
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ static GES_INIT: Once = Once::new();
|
|||
|
||||
pub fn init() -> Result<(), glib::BoolError> {
|
||||
if gst::init().is_err() {
|
||||
return Err(glib::glib_bool_error!("Could not initialize GStreamer."));
|
||||
return Err(glib::bool_error!("Could not initialize GStreamer."));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
if from_glib(ffi::ges_init()) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Could not initialize GES."))
|
||||
Err(glib::bool_error!("Could not initialize GES."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
|
|||
ptr::null_mut(),
|
||||
));
|
||||
if !found {
|
||||
return Err(glib::glib_bool_error!("Child property not found"));
|
||||
return Err(glib::bool_error!("Child property not found"));
|
||||
}
|
||||
|
||||
let value = value.to_value();
|
||||
|
|
|
@ -19,7 +19,7 @@ impl GLDisplayEGL {
|
|||
from_glib_full::<_, Option<GLDisplayEGL>>(ffi::gst_gl_display_egl_new_with_egl_display(
|
||||
display as gpointer,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create new EGL GL display"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create new EGL GL display"))
|
||||
}
|
||||
|
||||
pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer {
|
||||
|
|
|
@ -88,14 +88,14 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> {
|
|||
|
||||
let n_mem = match buffer_n_gl_memory(buffer) {
|
||||
Some(n) => n,
|
||||
None => return Err(glib::glib_bool_error!("Memory is not a GstGLMemory")),
|
||||
None => return Err(glib::bool_error!("Memory is not a GstGLMemory")),
|
||||
};
|
||||
|
||||
// FIXME: planes are not memories, in multiview use case,
|
||||
// number of memories = planes * views, but the raw memory is
|
||||
// not exposed in videoframe
|
||||
if n_mem != info.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Number of planes and memories is not matching"
|
||||
));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Failed to fill in the values of GstVideoFrame"
|
||||
))
|
||||
} else {
|
||||
|
|
|
@ -18,6 +18,6 @@ impl GLDisplayWayland {
|
|||
from_glib_full::<_, Option<GLDisplayWayland>>(ffi::gst_gl_display_wayland_new_with_display(
|
||||
display as gpointer,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create new Wayland GL display"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create new Wayland GL display"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ impl GLDisplayX11 {
|
|||
from_glib_full::<_, Option<GLDisplayX11>>(ffi::gst_gl_display_x11_new_with_display(
|
||||
display as gpointer,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create new X11 GL display"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create new X11 GL display"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ impl EncodingContainerProfile {
|
|||
profile: &P,
|
||||
) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_encoding_container_profile_add_profile(
|
||||
self.to_glib_none().0,
|
||||
profile.as_ref().to_glib_full(),
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn pb_utils_add_codec_description_to_tag_list_for_tag<'a, T: CodecTag<'a>>(
|
|||
assert_initialized_main_thread!();
|
||||
let codec_tag = T::tag_name();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
||||
taglist.as_mut_ptr(),
|
||||
codec_tag.to_glib_none().0,
|
||||
|
@ -35,7 +35,7 @@ pub fn pb_utils_add_codec_description_to_tag_list(
|
|||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
||||
taglist.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
|
@ -53,7 +53,7 @@ pub fn pb_utils_get_encoder_description(
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_pb_utils_get_encoder_description(caps.as_ptr())) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!("Failed to get encoder description")),
|
||||
None => Err(glib::bool_error!("Failed to get encoder description")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ pub fn pb_utils_get_decoder_description(
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_pb_utils_get_decoder_description(caps.as_ptr())) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!("Failed to get decoder description")),
|
||||
None => Err(glib::bool_error!("Failed to get decoder description")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ pub fn pb_utils_get_codec_description(
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_pb_utils_get_codec_description(caps.as_ptr())) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!("Failed to get codec description")),
|
||||
None => Err(glib::bool_error!("Failed to get codec description")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ impl Player {
|
|||
|
||||
pub fn set_config(&self, config: crate::PlayerConfig) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_player_set_config(self.to_glib_none().0, config.into_ptr()),
|
||||
"Failed to set config",
|
||||
)
|
||||
|
|
|
@ -49,7 +49,7 @@ impl<'a> RTPBuffer<'a, Readable> {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map RTP buffer readable"))
|
||||
Err(glib::bool_error!("Failed to map RTP buffer readable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ impl<'a> RTPBuffer<'a, Writable> {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map RTP buffer writable"))
|
||||
Err(glib::bool_error!("Failed to map RTP buffer writable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,9 +139,7 @@ impl<'a> RTPBuffer<'a, Writable> {
|
|||
if result {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to add onebyte header extension"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to add onebyte header extension"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,9 +167,7 @@ impl<'a> RTPBuffer<'a, Writable> {
|
|||
if result {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to add twobytes header extension"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to add twobytes header extension"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +237,7 @@ impl<'a, T> RTPBuffer<'a, T> {
|
|||
let pointer =
|
||||
ffi::gst_rtp_buffer_get_payload(glib::translate::mut_override(&self.rtp_buffer));
|
||||
if pointer.is_null() {
|
||||
Err(glib::glib_bool_error!("Failed to get payload data"))
|
||||
Err(glib::bool_error!("Failed to get payload data"))
|
||||
} else {
|
||||
Ok(slice::from_raw_parts(pointer as *const u8, size as usize))
|
||||
}
|
||||
|
@ -346,7 +342,7 @@ impl RTPBufferExt for gst::Buffer {
|
|||
pad_len,
|
||||
csrc_count,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to allocate new RTP buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to allocate new RTP buffer"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::sdp_bandwidth::SDPBandwidth;
|
|||
use crate::sdp_connection::SDPConnection;
|
||||
use crate::sdp_key::SDPKey;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct SDPMedia(Boxed<ffi::GstSDPMedia>);
|
||||
|
||||
|
@ -160,7 +160,7 @@ impl SDPMediaRef {
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_sdp_media_as_text(&self.0)) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
None => Err(glib::bool_error!(
|
||||
"Failed to convert the contents of media to a text string"
|
||||
)),
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::sdp_origin::SDPOrigin;
|
|||
use crate::sdp_time::SDPTime;
|
||||
use crate::sdp_zone::SDPZone;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct SDPMessage(Boxed<ffi::GstSDPMessage>);
|
||||
|
||||
|
@ -210,7 +210,7 @@ impl SDPMessageRef {
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_sdp_message_as_text(&self.0)) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
None => Err(glib::bool_error!(
|
||||
"Failed to convert the contents of message to a text string"
|
||||
)),
|
||||
}
|
||||
|
@ -830,9 +830,7 @@ impl SDPMessageRef {
|
|||
&self.0,
|
||||
)) {
|
||||
Some(s) => Ok(s),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
"Failed to create an URI from message"
|
||||
)),
|
||||
None => Err(glib::bool_error!("Failed to create an URI from message")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ impl crate::VideoColorMatrix {
|
|||
unsafe {
|
||||
let mut kr = mem::MaybeUninit::uninit();
|
||||
let mut kb = mem::MaybeUninit::uninit();
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_color_matrix_get_Kr_Kb(
|
||||
self.to_glib(),
|
||||
kr.as_mut_ptr(),
|
||||
|
|
|
@ -28,11 +28,11 @@ impl VideoConverter {
|
|||
) -> Result<Self, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
if in_info.fps() != out_info.fps() {
|
||||
return Err(glib::glib_bool_error!("Can't do framerate conversion"));
|
||||
return Err(glib::bool_error!("Can't do framerate conversion"));
|
||||
}
|
||||
|
||||
if in_info.interlace_mode() != out_info.interlace_mode() {
|
||||
return Err(glib::glib_bool_error!("Can't do interlacing conversion"));
|
||||
return Err(glib::bool_error!("Can't do interlacing conversion"));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -42,7 +42,7 @@ impl VideoConverter {
|
|||
config.map(|s| s.0.into_ptr()).unwrap_or(ptr::null_mut()),
|
||||
);
|
||||
if ptr.is_null() {
|
||||
Err(glib::glib_bool_error!("Failed to create video converter"))
|
||||
Err(glib::bool_error!("Failed to create video converter"))
|
||||
} else {
|
||||
Ok(VideoConverter(ptr::NonNull::new_unchecked(ptr)))
|
||||
}
|
||||
|
@ -130,9 +130,7 @@ impl convert::TryFrom<gst::Structure> for VideoConverterConfig {
|
|||
if v.get_name() == "GstVideoConverter" {
|
||||
Ok(VideoConverterConfig(v))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Structure is no VideoConverterConfig"
|
||||
))
|
||||
Err(glib::bool_error!("Structure is no VideoConverterConfig"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ impl DownstreamForceKeyUnitEvent {
|
|||
count: count.assume_init(),
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to parse GstEvent"))
|
||||
Err(glib::bool_error!("Failed to parse GstEvent"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ impl UpstreamForceKeyUnitEvent {
|
|||
count: count.assume_init(),
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to parse GstEvent"))
|
||||
Err(glib::bool_error!("Failed to parse GstEvent"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ impl StillFrameEvent {
|
|||
in_still: from_glib(in_still.assume_init()),
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Invalid still-frame event"))
|
||||
Err(glib::bool_error!("Invalid still-frame event"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ impl str::FromStr for crate::VideoFormat {
|
|||
|
||||
let fmt = Self::from_string(s);
|
||||
if fmt == Self::Unknown {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Failed to parse video format from string"
|
||||
))
|
||||
} else {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl<T> VideoFrame<T> {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to copy video frame"))
|
||||
Err(glib::bool_error!("Failed to copy video frame"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ impl<T> VideoFrame<T> {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to copy video frame plane"))
|
||||
Err(glib::bool_error!("Failed to copy video frame plane"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ impl<T> VideoFrame<T> {
|
|||
|
||||
pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ impl VideoFrame<Writable> {
|
|||
|
||||
pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ impl<T> VideoFrameRef<T> {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to copy video frame"))
|
||||
Err(glib::bool_error!("Failed to copy video frame"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ impl<T> VideoFrameRef<T> {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to copy video frame plane"))
|
||||
Err(glib::bool_error!("Failed to copy video frame plane"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ impl<T> VideoFrameRef<T> {
|
|||
|
||||
pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map VideoFrame"))
|
||||
Err(glib::bool_error!("Failed to map VideoFrame"))
|
||||
} else {
|
||||
let frame = frame.assume_init();
|
||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||
|
@ -623,7 +623,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map VideoFrame"))
|
||||
Err(glib::bool_error!("Failed to map VideoFrame"))
|
||||
} else {
|
||||
let frame = frame.assume_init();
|
||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||
|
@ -688,7 +688,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map VideoFrame"))
|
||||
Err(glib::bool_error!("Failed to map VideoFrame"))
|
||||
} else {
|
||||
let frame = frame.assume_init();
|
||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||
|
@ -724,7 +724,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
));
|
||||
|
||||
if !res {
|
||||
Err(glib::glib_bool_error!("Failed to map VideoFrame"))
|
||||
Err(glib::bool_error!("Failed to map VideoFrame"))
|
||||
} else {
|
||||
let frame = frame.assume_init();
|
||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||
|
@ -744,7 +744,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
|
||||
pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> {
|
||||
if plane >= self.n_planes() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Plane index higher than number of planes"
|
||||
));
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ impl str::FromStr for crate::VideoColorimetry {
|
|||
if valid {
|
||||
Ok(Self(colorimetry.assume_init()))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Invalid colorimetry info"))
|
||||
Err(glib::bool_error!("Invalid colorimetry info"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ impl str::FromStr for crate::VideoChromaSite {
|
|||
};
|
||||
|
||||
if chroma_site.is_empty() {
|
||||
Err(glib::glib_bool_error!("Invalid chroma site"))
|
||||
Err(glib::bool_error!("Invalid chroma site"))
|
||||
} else {
|
||||
Ok(chroma_site)
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ impl std::convert::TryFrom<crate::VideoMultiviewMode> for crate::VideoMultiviewF
|
|||
let v2 = unsafe { from_glib(v.to_glib()) };
|
||||
|
||||
if let crate::VideoMultiviewFramePacking::__Unknown(_) = v2 {
|
||||
Err(glib::glib_bool_error!("Invalid frame packing mode"))
|
||||
Err(glib::bool_error!("Invalid frame packing mode"))
|
||||
} else {
|
||||
Ok(v2)
|
||||
}
|
||||
|
@ -370,13 +370,13 @@ impl<'a> VideoInfoBuilder<'a> {
|
|||
}
|
||||
|
||||
if !res {
|
||||
return Err(glib::glib_bool_error!("Failed to build VideoInfo"));
|
||||
return Err(glib::bool_error!("Failed to build VideoInfo"));
|
||||
}
|
||||
|
||||
let mut info = info.assume_init();
|
||||
|
||||
if info.finfo.is_null() || info.width <= 0 || info.height <= 0 {
|
||||
return Err(glib::glib_bool_error!("Failed to build VideoInfo"));
|
||||
return Err(glib::bool_error!("Failed to build VideoInfo"));
|
||||
}
|
||||
|
||||
if let Some(flags) = self.flags {
|
||||
|
@ -411,7 +411,7 @@ impl<'a> VideoInfoBuilder<'a> {
|
|||
|
||||
if let Some(offset) = self.offset {
|
||||
if offset.len() != ((*info.finfo).n_planes as usize) {
|
||||
return Err(glib::glib_bool_error!("Failed to build VideoInfo"));
|
||||
return Err(glib::bool_error!("Failed to build VideoInfo"));
|
||||
}
|
||||
|
||||
let n_planes = (*info.finfo).n_planes as usize;
|
||||
|
@ -420,7 +420,7 @@ impl<'a> VideoInfoBuilder<'a> {
|
|||
|
||||
if let Some(stride) = self.stride {
|
||||
if stride.len() != ((*info.finfo).n_planes as usize) {
|
||||
return Err(glib::glib_bool_error!("Failed to build VideoInfo"));
|
||||
return Err(glib::bool_error!("Failed to build VideoInfo"));
|
||||
}
|
||||
|
||||
let n_planes = (*info.finfo).n_planes as usize;
|
||||
|
@ -606,9 +606,7 @@ impl VideoInfo {
|
|||
)) {
|
||||
Ok(VideoInfo(info.assume_init()))
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to create VideoInfo from caps"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to create VideoInfo from caps"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -618,9 +616,7 @@ impl VideoInfo {
|
|||
let result = from_glib_full(ffi::gst_video_info_to_caps(&self.0 as *const _ as *mut _));
|
||||
match result {
|
||||
Some(c) => Ok(c),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
"Failed to create caps from VideoInfo"
|
||||
)),
|
||||
None => Err(glib::bool_error!("Failed to create caps from VideoInfo")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -800,7 +796,7 @@ impl VideoInfo {
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "v1_12")] {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(ffi::gst_video_info_align(
|
||||
glib::result_from_gboolean!(ffi::gst_video_info_align(
|
||||
&mut self.0,
|
||||
&mut align.0,
|
||||
), "Failed to align VideoInfo")
|
||||
|
@ -814,7 +810,7 @@ impl VideoInfo {
|
|||
|
||||
Ok(())
|
||||
} else {
|
||||
glib::glib_result_from_gboolean!(ffi::gst_video_info_align(
|
||||
glib::result_from_gboolean!(ffi::gst_video_info_align(
|
||||
&mut self.0,
|
||||
&mut align.0,
|
||||
), "Failed to align VideoInfo")
|
||||
|
@ -833,7 +829,7 @@ impl VideoInfo {
|
|||
let mut plane_size = [0; crate::VIDEO_MAX_PLANES];
|
||||
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_info_align_full(&mut self.0, &mut align.0, plane_size.as_mut_ptr()),
|
||||
"Failed to align VideoInfo"
|
||||
)?;
|
||||
|
@ -971,7 +967,7 @@ impl str::FromStr for crate::VideoFieldOrder {
|
|||
|
||||
let fmt = Self::from_string(s);
|
||||
if fmt == Self::Unknown {
|
||||
Err(glib::glib_bool_error!(
|
||||
Err(glib::bool_error!(
|
||||
"Failed to parse video field order from string"
|
||||
))
|
||||
} else {
|
||||
|
|
|
@ -23,20 +23,17 @@ impl VideoMeta {
|
|||
skip_assert_initialized!();
|
||||
|
||||
if format == crate::VideoFormat::Unknown || format == crate::VideoFormat::Encoded {
|
||||
return Err(glib::glib_bool_error!(
|
||||
"Unsupported video format {}",
|
||||
format
|
||||
));
|
||||
return Err(glib::bool_error!("Unsupported video format {}", format));
|
||||
}
|
||||
|
||||
let info = crate::VideoInfo::builder(format, width, height).build()?;
|
||||
|
||||
if !info.is_valid() {
|
||||
return Err(glib::glib_bool_error!("Invalid video info"));
|
||||
return Err(glib::bool_error!("Invalid video info"));
|
||||
}
|
||||
|
||||
if buffer.get_size() < info.size() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Buffer smaller than required frame size ({} < {})",
|
||||
buffer.get_size(),
|
||||
info.size()
|
||||
|
@ -53,7 +50,7 @@ impl VideoMeta {
|
|||
);
|
||||
|
||||
if meta.is_null() {
|
||||
return Err(glib::glib_bool_error!("Failed to add video meta"));
|
||||
return Err(glib::bool_error!("Failed to add video meta"));
|
||||
}
|
||||
|
||||
Ok(Self::from_mut_ptr(buffer, meta))
|
||||
|
@ -72,10 +69,7 @@ impl VideoMeta {
|
|||
skip_assert_initialized!();
|
||||
|
||||
if format == crate::VideoFormat::Unknown || format == crate::VideoFormat::Encoded {
|
||||
return Err(glib::glib_bool_error!(
|
||||
"Unsupported video format {}",
|
||||
format
|
||||
));
|
||||
return Err(glib::bool_error!("Unsupported video format {}", format));
|
||||
}
|
||||
|
||||
let n_planes = offset.len() as u32;
|
||||
|
@ -85,11 +79,11 @@ impl VideoMeta {
|
|||
.build()?;
|
||||
|
||||
if !info.is_valid() {
|
||||
return Err(glib::glib_bool_error!("Invalid video info"));
|
||||
return Err(glib::bool_error!("Invalid video info"));
|
||||
}
|
||||
|
||||
if buffer.get_size() < info.size() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Buffer smaller than required frame size ({} < {})",
|
||||
buffer.get_size(),
|
||||
info.size()
|
||||
|
@ -109,7 +103,7 @@ impl VideoMeta {
|
|||
);
|
||||
|
||||
if meta.is_null() {
|
||||
return Err(glib::glib_bool_error!("Failed to add video meta"));
|
||||
return Err(glib::bool_error!("Failed to add video meta"));
|
||||
}
|
||||
|
||||
Ok(Self::from_mut_ptr(buffer, meta))
|
||||
|
@ -166,7 +160,7 @@ impl VideoMeta {
|
|||
let mut plane_size = [0; crate::VIDEO_MAX_PLANES];
|
||||
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_meta_get_plane_size(
|
||||
&self.0 as *const _ as usize as *mut _,
|
||||
&mut plane_size,
|
||||
|
@ -184,7 +178,7 @@ impl VideoMeta {
|
|||
let mut plane_height = [0; crate::VIDEO_MAX_PLANES];
|
||||
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_meta_get_plane_height(
|
||||
&self.0 as *const _ as usize as *mut _,
|
||||
&mut plane_height,
|
||||
|
@ -203,7 +197,7 @@ impl VideoMeta {
|
|||
alignment: &crate::VideoAlignment,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_meta_set_alignment(&mut self.0, alignment.0),
|
||||
"Failed to set alignment on VideoMeta"
|
||||
)
|
||||
|
|
|
@ -199,7 +199,7 @@ impl VideoOverlayComposition {
|
|||
|
||||
let first = match iter.next() {
|
||||
None => {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Failed to create VideoOverlayComposition"
|
||||
))
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ impl VideoOverlayCompositionRef {
|
|||
|
||||
pub fn get_rectangle(&self, idx: u32) -> Result<VideoOverlayRectangle, glib::error::BoolError> {
|
||||
if idx >= self.n_rectangles() {
|
||||
return Err(glib::glib_bool_error!("Invalid index"));
|
||||
return Err(glib::bool_error!("Invalid index"));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -237,7 +237,7 @@ impl VideoOverlayCompositionRef {
|
|||
idx,
|
||||
)) {
|
||||
Some(r) => Ok(r),
|
||||
None => Err(glib::glib_bool_error!("Failed to get rectangle")),
|
||||
None => Err(glib::bool_error!("Failed to get rectangle")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ impl VideoOverlayCompositionRef {
|
|||
frame: &mut crate::VideoFrameRef<&mut gst::BufferRef>,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_video_overlay_composition_blend(self.as_mut_ptr(), frame.as_mut_ptr()),
|
||||
"Failed to blend overlay composition",
|
||||
)
|
||||
|
|
|
@ -84,7 +84,7 @@ impl VideoTimeCode {
|
|||
);
|
||||
|
||||
if res == glib::ffi::GFALSE {
|
||||
Err(glib::glib_bool_error!("Failed to init video time code"))
|
||||
Err(glib::bool_error!("Failed to init video time code"))
|
||||
} else {
|
||||
Ok(VideoTimeCode(v.assume_init()))
|
||||
}
|
||||
|
@ -166,9 +166,7 @@ impl ValidVideoTimeCode {
|
|||
);
|
||||
match tc.try_into() {
|
||||
Ok(v) => Ok(v),
|
||||
Err(_) => Err(glib::glib_bool_error!(
|
||||
"Failed to create new ValidVideoTimeCode"
|
||||
)),
|
||||
Err(_) => Err(glib::bool_error!("Failed to create new ValidVideoTimeCode")),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +201,7 @@ impl ValidVideoTimeCode {
|
|||
tc_inter.to_glib_none().0,
|
||||
)) {
|
||||
Some(i) => Ok(i),
|
||||
None => Err(glib::glib_bool_error!("Failed to add interval")),
|
||||
None => Err(glib::bool_error!("Failed to add interval")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +228,7 @@ impl ValidVideoTimeCode {
|
|||
unsafe {
|
||||
match from_glib_full(ffi::gst_video_time_code_to_date_time(self.to_glib_none().0)) {
|
||||
Some(d) => Ok(d),
|
||||
None => Err(glib::glib_bool_error!(
|
||||
None => Err(glib::bool_error!(
|
||||
"Failed to convert VideoTimeCode to date time"
|
||||
)),
|
||||
}
|
||||
|
@ -475,7 +473,7 @@ impl str::FromStr for VideoTimeCode {
|
|||
Option::<Self>::from_glib_full(ffi::gst_video_time_code_new_from_string(
|
||||
s.to_glib_none().0,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create VideoTimeCode from string"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create VideoTimeCode from string"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,9 +120,7 @@ impl str::FromStr for VideoTimeCodeInterval {
|
|||
Option::<Self>::from_glib_full(ffi::gst_video_time_code_interval_new_from_string(
|
||||
s.to_glib_none().0,
|
||||
))
|
||||
.ok_or_else(|| {
|
||||
glib::glib_bool_error!("Failed to create VideoTimeCodeInterval from string")
|
||||
})
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create VideoTimeCodeInterval from string"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ impl<O: IsA<Allocator>> AllocatorExtManual for O {
|
|||
},
|
||||
);
|
||||
if ret.is_null() {
|
||||
Err(glib::glib_bool_error!("Failed to allocate memory"))
|
||||
Err(glib::bool_error!("Failed to allocate memory"))
|
||||
} else {
|
||||
Ok(from_glib_full(ret))
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
|||
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
||||
for e in elements {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_bin_add(self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0),
|
||||
"Failed to add elements"
|
||||
)?;
|
||||
|
@ -72,7 +72,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
|||
fn remove_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
||||
for e in elements {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_bin_remove(
|
||||
self.as_ref().to_glib_none().0,
|
||||
e.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -54,7 +54,7 @@ impl Buffer {
|
|||
size,
|
||||
ptr::null_mut(),
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to allocate buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to allocate buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ impl BufferRef {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map buffer readable"))
|
||||
Err(glib::bool_error!("Failed to map buffer readable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ impl BufferRef {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map buffer writable"))
|
||||
Err(glib::bool_error!("Failed to map buffer writable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ impl BufferRef {
|
|||
offset,
|
||||
size_real,
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to copy region of buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to copy region of buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ impl BufferRef {
|
|||
) -> Result<(), glib::BoolError> {
|
||||
let size_real = size.unwrap_or(usize::MAX);
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_buffer_copy_into(
|
||||
dest.as_mut_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
|
@ -292,7 +292,7 @@ impl BufferRef {
|
|||
pub fn copy_deep(&self) -> Result<Buffer, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_buffer_copy_deep(self.as_ptr()))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to deep copy buffer"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to deep copy buffer"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ impl BufferRef {
|
|||
unsafe {
|
||||
let mem = ffi::gst_buffer_peek_memory(self.as_mut_ptr(), idx);
|
||||
if ffi::gst_mini_object_is_writable(mem as *mut _) == glib::ffi::GFALSE {
|
||||
Err(glib::glib_bool_error!("Memory not writable"))
|
||||
Err(glib::bool_error!("Memory not writable"))
|
||||
} else {
|
||||
Ok(MemoryRef::from_mut_ptr(ffi::gst_buffer_peek_memory(
|
||||
self.as_mut_ptr(),
|
||||
|
@ -660,7 +660,7 @@ impl BufferRef {
|
|||
|
||||
pub fn iter_memories_mut(&mut self) -> Result<IterMut, glib::BoolError> {
|
||||
if !self.is_all_memory_writable() {
|
||||
Err(glib::glib_bool_error!("Not all memory are writable"))
|
||||
Err(glib::bool_error!("Not all memory are writable"))
|
||||
} else {
|
||||
Ok(IterMut::new(self))
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ impl BufferCursor<Writable> {
|
|||
pub(crate) fn new_writable(buffer: Buffer) -> Result<BufferCursor<Writable>, glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
if !buffer.is_writable() || !buffer.is_all_memory_writable() {
|
||||
return Err(glib::glib_bool_error!("Not all memories are writable"));
|
||||
return Err(glib::bool_error!("Not all memories are writable"));
|
||||
}
|
||||
|
||||
let size = buffer.get_size() as u64;
|
||||
|
@ -400,7 +400,7 @@ impl<'a> BufferRefCursor<&'a mut BufferRef> {
|
|||
) -> Result<BufferRefCursor<&'a mut BufferRef>, glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
if !buffer.is_all_memory_writable() {
|
||||
return Err(glib::glib_bool_error!("Not all memories are writable"));
|
||||
return Err(glib::bool_error!("Not all memories are writable"));
|
||||
}
|
||||
|
||||
let size = buffer.get_size() as u64;
|
||||
|
|
|
@ -129,7 +129,7 @@ impl BufferPoolConfig {
|
|||
max_buffers: u32,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_buffer_pool_config_validate_params(
|
||||
self.0.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
|
@ -301,7 +301,7 @@ impl<O: IsA<BufferPool>> BufferPoolExtManual for O {
|
|||
|
||||
fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_buffer_pool_set_config(
|
||||
self.as_ref().to_glib_none().0,
|
||||
config.0.into_ptr()
|
||||
|
|
|
@ -117,7 +117,7 @@ impl Bus {
|
|||
);
|
||||
|
||||
if res == 0 {
|
||||
Err(glib::glib_bool_error!("Bus already has a watch"))
|
||||
Err(glib::bool_error!("Bus already has a watch"))
|
||||
} else {
|
||||
Ok(from_glib(res))
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ impl Bus {
|
|||
);
|
||||
|
||||
if res == 0 {
|
||||
Err(glib::glib_bool_error!("Bus already has a watch"))
|
||||
Err(glib::bool_error!("Bus already has a watch"))
|
||||
} else {
|
||||
Ok(from_glib(res))
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ impl str::FromStr for Caps {
|
|||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_caps_from_string(s.to_glib_none().0))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to parse caps from string"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to parse caps from string"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ impl str::FromStr for CapsFeatures {
|
|||
unsafe {
|
||||
let ptr = ffi::gst_caps_features_from_string(s.to_glib_none().0);
|
||||
if ptr.is_null() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Failed to parse caps features from string"
|
||||
));
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
|
|||
ptr::null_mut(),
|
||||
));
|
||||
if !found {
|
||||
return Err(glib::glib_bool_error!("Child property not found"));
|
||||
return Err(glib::bool_error!("Child property not found"));
|
||||
}
|
||||
|
||||
let value = value.to_value();
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::pin::Pin;
|
|||
use std::sync::atomic;
|
||||
use std::sync::atomic::AtomicI32;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
|
||||
pub struct ClockId(Shared<c_void>);
|
||||
|
||||
|
@ -117,7 +117,7 @@ impl convert::TryFrom<ClockId> for SingleShotClockId {
|
|||
skip_assert_initialized!();
|
||||
match id.get_type() {
|
||||
ClockEntryType::Single => Ok(SingleShotClockId(id)),
|
||||
_ => Err(glib::glib_bool_error!("Not a single-shot clock id")),
|
||||
_ => Err(glib::bool_error!("Not a single-shot clock id")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ impl convert::TryFrom<ClockId> for PeriodicClockId {
|
|||
skip_assert_initialized!();
|
||||
match id.get_type() {
|
||||
ClockEntryType::Periodic => Ok(PeriodicClockId(id)),
|
||||
_ => Err(glib::glib_bool_error!("Not a periodic clock id")),
|
||||
_ => Err(glib::bool_error!("Not a periodic clock id")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to reinit periodic clock id"))
|
||||
Err(glib::bool_error!("Failed to reinit periodic clock id"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -461,9 +461,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
|
|||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to reinit single shot clock id"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to reinit single shot clock id"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ impl convert::TryFrom<ClockTime> for Duration {
|
|||
|
||||
t.nanoseconds()
|
||||
.map(Duration::from_nanos)
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't convert ClockTime::NONE to Duration"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't convert ClockTime::NONE to Duration"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<O: IsA<ControlBinding>> ControlBindingExtManual for O {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
let n_values = values.len() as u32;
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_control_binding_get_g_value_array(
|
||||
self.as_ref().to_glib_none().0,
|
||||
timestamp.to_glib(),
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<O: IsA<ControlSource>> ControlSourceExtManual for O {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
let n_values = values.len() as u32;
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_control_source_get_value_array(
|
||||
self.as_ref().to_glib_none().0,
|
||||
timestamp.to_glib(),
|
||||
|
|
|
@ -21,14 +21,14 @@ fn validate(
|
|||
|
||||
// Check for valid ranges
|
||||
if year <= 0 || year > 9999 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Year out of range"
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(month) = month {
|
||||
if month <= 0 || month > 12 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Month out of range"
|
||||
));
|
||||
}
|
||||
|
@ -36,15 +36,13 @@ fn validate(
|
|||
|
||||
if let Some(day) = day {
|
||||
if day <= 0 || day > 31 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
"Can't create DateTime: Day out of range"
|
||||
));
|
||||
return Err(glib::bool_error!("Can't create DateTime: Day out of range"));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(hour) = hour {
|
||||
if hour < 0 || hour >= 24 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Hour out of range"
|
||||
));
|
||||
}
|
||||
|
@ -52,7 +50,7 @@ fn validate(
|
|||
|
||||
if let Some(minute) = minute {
|
||||
if minute < 0 || minute >= 60 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Minute out of range"
|
||||
));
|
||||
}
|
||||
|
@ -60,7 +58,7 @@ fn validate(
|
|||
|
||||
if let Some(seconds) = seconds {
|
||||
if seconds < 0.0 || seconds >= 60.0 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Seconds out of range"
|
||||
));
|
||||
}
|
||||
|
@ -68,7 +66,7 @@ fn validate(
|
|||
|
||||
if let Some(tzoffset) = tzoffset {
|
||||
if tzoffset < -12.0 || tzoffset > 12.0 {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Timezone offset out of range"
|
||||
));
|
||||
}
|
||||
|
@ -76,34 +74,34 @@ fn validate(
|
|||
|
||||
// If day is provided, month also has to be provided
|
||||
if day.is_some() && month.is_none() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Need to provide month if providing day"
|
||||
));
|
||||
}
|
||||
|
||||
// If hour is provided, day also has to be provided
|
||||
if hour.is_some() && day.is_none() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Need to provide day if providing hour"
|
||||
));
|
||||
}
|
||||
|
||||
// If minutes are provided, hours also need to be provided and the other way around
|
||||
if hour.is_none() && minute.is_some() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Need to provide both hour and minute or neither"
|
||||
));
|
||||
}
|
||||
|
||||
if minute.is_some() && hour.is_none() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Can't create DateTime: Need to provide both hour and minute or neither"
|
||||
));
|
||||
}
|
||||
|
||||
// If seconds or tzoffset are provided then also hours and minutes must be provided
|
||||
if (seconds.is_some() || tzoffset.is_some()) && (hour.is_none() || minute.is_none()) {
|
||||
return Err(glib::glib_bool_error!("Can't create DateTime: Need to provide hour and minute if providing seconds or timezone offset"));
|
||||
return Err(glib::bool_error!("Can't create DateTime: Need to provide hour and minute if providing seconds or timezone offset"));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -149,7 +147,7 @@ impl DateTime {
|
|||
minute.unwrap_or(-1),
|
||||
seconds.unwrap_or(-1.0),
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't create DateTime"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't create DateTime"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +186,7 @@ impl DateTime {
|
|||
minute.unwrap_or(-1),
|
||||
seconds.unwrap_or(-1.0),
|
||||
))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't create DateTime"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't create DateTime"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +197,7 @@ impl DateTime {
|
|||
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_date_time_new_y(year))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't create DateTime"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't create DateTime"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +208,7 @@ impl DateTime {
|
|||
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_date_time_new_ym(year, month))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't create DateTime"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't create DateTime"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +219,7 @@ impl DateTime {
|
|||
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_date_time_new_ymd(year, month, day))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't create DateTime"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't create DateTime"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +298,7 @@ impl DateTime {
|
|||
self.to_g_date_time()
|
||||
.and_then(|d| {
|
||||
d.to_utc()
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't convert datetime to UTC"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't convert datetime to UTC"))
|
||||
})
|
||||
.map(|d| d.into())
|
||||
} else {
|
||||
|
@ -320,7 +318,7 @@ impl DateTime {
|
|||
.and_then(|d| d.to_g_date_time())
|
||||
.and_then(|d| {
|
||||
d.to_utc()
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't convert datetime to UTC"))
|
||||
.ok_or_else(|| glib::bool_error!("Can't convert datetime to UTC"))
|
||||
})
|
||||
.and_then(|d| {
|
||||
DateTime::new(
|
||||
|
|
|
@ -114,18 +114,18 @@ impl TryFrom<DateTimeVariants> for Date {
|
|||
DateTimeVariants::YMD(y, m, d) => {
|
||||
let month = unsafe { glib::DateMonth::from_glib(m) };
|
||||
if let glib::DateMonth::__Unknown(_) = month {
|
||||
return Err(glib::glib_bool_error!("Out of range `month` for `Date`"));
|
||||
return Err(glib::bool_error!("Out of range `month` for `Date`"));
|
||||
}
|
||||
|
||||
Ok(Date(glib::Date::new_dmy(
|
||||
d.try_into()
|
||||
.map_err(|_| glib::glib_bool_error!("Out of range `day` for `Date`"))?,
|
||||
.map_err(|_| glib::bool_error!("Out of range `day` for `Date`"))?,
|
||||
month,
|
||||
y.try_into()
|
||||
.map_err(|_| glib::glib_bool_error!("Out of range `year` for `Date`"))?,
|
||||
.map_err(|_| glib::bool_error!("Out of range `year` for `Date`"))?,
|
||||
)))
|
||||
}
|
||||
_ => Err(glib::glib_bool_error!(
|
||||
_ => Err(glib::bool_error!(
|
||||
"Incompatible variant for `Date` (expecting \"YMD\")"
|
||||
)),
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
|
|||
filter_id: DeviceMonitorFilterId,
|
||||
) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_device_monitor_remove_filter(
|
||||
self.as_ref().to_glib_none().0,
|
||||
filter_id.to_glib()
|
||||
|
|
|
@ -19,7 +19,7 @@ impl DeviceProvider {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_device_provider_register(
|
||||
plugin.to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
|
|
|
@ -50,7 +50,7 @@ impl Element {
|
|||
skip_assert_initialized!();
|
||||
for e in elements.windows(2) {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_element_link(
|
||||
e[0].as_ref().to_glib_none().0,
|
||||
e[1].as_ref().to_glib_none().0,
|
||||
|
@ -83,7 +83,7 @@ impl Element {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_element_register(
|
||||
plugin.to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
|
@ -454,7 +454,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
|
||||
fn post_message(&self, message: crate::Message) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_element_post_message(self.as_ref().to_glib_none().0, message.into_ptr()),
|
||||
"Failed to post message"
|
||||
)
|
||||
|
@ -731,7 +731,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
assert_eq!(stop.get_format(), start.get_format());
|
||||
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_element_seek(
|
||||
self.as_ref().to_glib_none().0,
|
||||
rate,
|
||||
|
@ -754,7 +754,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
let seek_pos = seek_pos.into();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_element_seek_simple(
|
||||
self.as_ref().to_glib_none().0,
|
||||
seek_pos.get_format().to_glib(),
|
||||
|
|
|
@ -83,12 +83,12 @@ impl ErrorMessage {
|
|||
macro_rules! gst_loggable_error(
|
||||
// Plain strings
|
||||
($cat:expr, $msg:expr) => {
|
||||
$crate::LoggableError::new($cat.clone(), $crate::glib::glib_bool_error!($msg))
|
||||
$crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($msg))
|
||||
};
|
||||
|
||||
// Format strings
|
||||
($cat:expr, $($msg:tt)*) => { {
|
||||
$crate::LoggableError::new($cat.clone(), $crate::glib::glib_bool_error!($($msg)*))
|
||||
$crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($($msg)*))
|
||||
}};
|
||||
);
|
||||
|
||||
|
@ -96,13 +96,13 @@ macro_rules! gst_loggable_error(
|
|||
macro_rules! gst_result_from_gboolean(
|
||||
// Plain strings
|
||||
($ffi_bool:expr, $cat:expr, $msg:expr) => {
|
||||
$crate::glib::glib_result_from_gboolean!($ffi_bool, $msg)
|
||||
$crate::glib::result_from_gboolean!($ffi_bool, $msg)
|
||||
.map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err))
|
||||
};
|
||||
|
||||
// Format strings
|
||||
($ffi_bool:expr, $cat:expr, $($msg:tt)*) => { {
|
||||
$crate::glib::glib_result_from_gboolean!($ffi_bool, $($msg)*)
|
||||
$crate::glib::result_from_gboolean!($ffi_bool, $($msg)*)
|
||||
.map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err))
|
||||
}};
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ impl GhostPad {
|
|||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_ghost_pad_activate_mode_default(
|
||||
pad.to_glib_none().0 as *mut ffi::GstPad,
|
||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||
|
@ -45,7 +45,7 @@ impl GhostPad {
|
|||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_ghost_pad_internal_activate_mode_default(
|
||||
pad.to_glib_none().0 as *mut ffi::GstPad,
|
||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||
|
@ -112,7 +112,7 @@ impl GhostPad {
|
|||
skip_assert_initialized!();
|
||||
|
||||
if target.get_direction() != templ.get_property_direction() {
|
||||
return Err(glib::glib_bool_error!(
|
||||
return Err(glib::bool_error!(
|
||||
"Template and target have different directions"
|
||||
));
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ impl MemoryRef {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map memory readable"))
|
||||
Err(glib::bool_error!("Failed to map memory readable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ impl MemoryRef {
|
|||
phantom: PhantomData,
|
||||
})
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to map memory writable"))
|
||||
Err(glib::bool_error!("Failed to map memory writable"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
|
|||
) -> Result<(), glib::error::BoolError> {
|
||||
let n_values = values.len() as u32;
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_object_get_g_value_array(
|
||||
self.as_ref().to_glib_none().0,
|
||||
property_name.to_glib_none().0,
|
||||
|
|
|
@ -745,7 +745,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn start_task<F: FnMut() + Send + 'static>(&self, func: F) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_pad_start_task(
|
||||
self.as_ref().to_glib_none().0,
|
||||
Some(trampoline_pad_task::<F>),
|
||||
|
|
|
@ -23,7 +23,7 @@ impl PadTemplate {
|
|||
pad_type.to_glib(),
|
||||
),
|
||||
)
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to create PadTemplate"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create PadTemplate"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct ParseContext(Boxed<ffi::GstParseContext>);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::pin::Pin;
|
|||
use std::ptr;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Promise(Shared<ffi::GstPromise>);
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
|
||||
pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_segment_offset_running_time(
|
||||
&mut self.0,
|
||||
self.get_format().to_glib(),
|
||||
|
@ -264,7 +264,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
glib::glib_result_from_gboolean!(
|
||||
glib::result_from_gboolean!(
|
||||
ffi::gst_segment_set_running_time(
|
||||
&mut self.0,
|
||||
self.get_format().to_glib(),
|
||||
|
|
|
@ -180,9 +180,7 @@ impl str::FromStr for Structure {
|
|||
unsafe {
|
||||
let structure = ffi::gst_structure_from_string(s.to_glib_none().0, ptr::null_mut());
|
||||
if structure.is_null() {
|
||||
Err(glib::glib_bool_error!(
|
||||
"Failed to parse structure from string"
|
||||
))
|
||||
Err(glib::bool_error!("Failed to parse structure from string"))
|
||||
} else {
|
||||
Ok(Self(ptr::NonNull::new_unchecked(
|
||||
structure as *mut StructureRef,
|
||||
|
|
|
@ -626,7 +626,7 @@ mod tests {
|
|||
type Instance = crate::subclass::ElementInstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn with_class(klass: &Self::Class) -> Self {
|
||||
let templ = klass.get_pad_template("sink").unwrap();
|
||||
|
@ -735,7 +735,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct TestElement(ObjectSubclass<imp::TestElement>) @extends Element, crate::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ mod tests {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -132,7 +132,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
glib::glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct TestPad(ObjectSubclass<imp::TestPad>) @extends Pad, crate::Object;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ macro_rules! gst_plugin_define(
|
|||
|
||||
pub fn plugin_register_static() -> Result<(), $crate::glib::BoolError> {
|
||||
unsafe {
|
||||
$crate::glib::glib_result_from_gboolean!(
|
||||
$crate::glib::result_from_gboolean!(
|
||||
$crate::ffi::gst_plugin_register_static(
|
||||
$crate::subclass::MAJOR_VERSION,
|
||||
$crate::subclass::MINOR_VERSION,
|
||||
|
|
|
@ -44,7 +44,7 @@ macro_rules! gst_plugin_define(
|
|||
|
||||
pub fn plugin_register_static() -> Result<(), $crate::glib::BoolError> {
|
||||
unsafe {
|
||||
$crate::glib::glib_result_from_gboolean!(
|
||||
$crate::glib::result_from_gboolean!(
|
||||
$crate::ffi::gst_plugin_register_static(
|
||||
$crate::subclass::MAJOR_VERSION,
|
||||
$crate::subclass::MINOR_VERSION,
|
||||
|
|
|
@ -50,7 +50,7 @@ impl TypeFind {
|
|||
Some(type_find_closure_drop::<F>),
|
||||
);
|
||||
|
||||
glib::glib_result_from_gboolean!(res, "Failed to register typefind factory")
|
||||
glib::result_from_gboolean!(res, "Failed to register typefind factory")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -882,7 +882,7 @@ impl GstValueExt for glib::Value {
|
|||
fn serialize(&self) -> Result<glib::GString, glib::BoolError> {
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_value_serialize(self.to_glib_none().0))
|
||||
.ok_or_else(|| glib::glib_bool_error!("Failed to serialize value"))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to serialize value"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -900,7 +900,7 @@ impl GstValueExt for glib::Value {
|
|||
if ret {
|
||||
Ok(value)
|
||||
} else {
|
||||
Err(glib::glib_bool_error!("Failed to deserialize value"))
|
||||
Err(glib::bool_error!("Failed to deserialize value"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue