Remove gst_ prefix from all macros except for the logging macros

The latter stay e.g. gst_debug! to be more clear and not conflict with
e.g. the debug! macro from the log crate.
This commit is contained in:
Sebastian Dröge 2020-12-20 17:09:22 +02:00
parent 08c54145d3
commit 53aae7ddba
54 changed files with 347 additions and 346 deletions

View file

@ -10,7 +10,7 @@
// This is the format we request: // This is the format we request:
// Audio / Signed 16bit / 1 channel / arbitrary sample rate // Audio / Signed 16bit / 1 channel / arbitrary sample rate
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
use byte_slice_cast::*; use byte_slice_cast::*;
@ -75,7 +75,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Pull the sample in question out of the appsink's buffer. // Pull the sample in question out of the appsink's buffer.
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.get_buffer().ok_or_else(|| { let buffer = sample.get_buffer().ok_or_else(|| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to get buffer from appsink") ("Failed to get buffer from appsink")
@ -92,7 +92,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// So mapping the buffer makes the underlying memory region accessible to us. // So mapping the buffer makes the underlying memory region accessible to us.
// See: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/allocation.html // See: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/allocation.html
let map = buffer.map_readable().map_err(|_| { let map = buffer.map_readable().map_err(|_| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to map buffer readable") ("Failed to map buffer readable")
@ -105,7 +105,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// it by setting the appsink's caps. So what we do here is interpret the // it by setting the appsink's caps. So what we do here is interpret the
// memory region we mapped as an array of signed 16 bit integers. // memory region we mapped as an array of signed 16 bit integers.
let samples = map.as_slice_of::<i16>().map_err(|_| { let samples = map.as_slice_of::<i16>().map_err(|_| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to interprete buffer as S16 PCM") ("Failed to interprete buffer as S16 PCM")

View file

@ -3,7 +3,7 @@
// It simply attaches a GstMeta with a Rust String to buffers that are passed into // It simply attaches a GstMeta with a Rust String to buffers that are passed into
// an appsrc and retrieves them again from an appsink. // an appsrc and retrieves them again from an appsink.
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
#[path = "../examples-common.rs"] #[path = "../examples-common.rs"]
@ -227,7 +227,7 @@ fn example_main() {
// Pull the sample in question out of the appsink's buffer. // Pull the sample in question out of the appsink's buffer.
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.get_buffer().ok_or_else(|| { let buffer = sample.get_buffer().ok_or_else(|| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to get buffer from appsink") ("Failed to get buffer from appsink")

View file

@ -5,6 +5,7 @@
// //
// It's possible to dump the logs at any time in an application, // It's possible to dump the logs at any time in an application,
// not just on exit like is done here. // not just on exit like is done here.
use gst::gst_error;
use gst::prelude::*; use gst::prelude::*;
use std::process; use std::process;
@ -70,7 +71,7 @@ fn example_main() {
.expect("Unable to set the pipeline to the `Null` state"); .expect("Unable to set the pipeline to the `Null` state");
/* Insert a message into the debug log */ /* Insert a message into the debug log */
gst::gst_error!(gst::CAT_DEFAULT, "Hi from the debug log ringbuffer example"); gst_error!(gst::CAT_DEFAULT, "Hi from the debug log ringbuffer example");
println!("Dumping debug logs\n"); println!("Dumping debug logs\n");
for s in gst::debug_ring_buffer_logger_get_logs().iter() { for s in gst::debug_ring_buffer_logger_get_logs().iter() {

View file

@ -29,8 +29,8 @@
// Especially Windows APIs tend to be quite picky about samplerate and sample-format. // Especially Windows APIs tend to be quite picky about samplerate and sample-format.
// The same applies to videostreams. // The same applies to videostreams.
use gst::gst_element_error; use gst::element_error;
use gst::gst_element_warning; use gst::element_warning;
use gst::prelude::*; use gst::prelude::*;
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
@ -122,7 +122,7 @@ fn example_main() -> Result<(), Error> {
match media_type { match media_type {
None => { None => {
gst_element_warning!( element_warning!(
dbin, dbin,
gst::CoreError::Negotiation, gst::CoreError::Negotiation,
("Failed to get media type from pad {}", src_pad.get_name()) ("Failed to get media type from pad {}", src_pad.get_name())
@ -208,7 +208,7 @@ fn example_main() -> Result<(), Error> {
// The following sends a message of type Error on the bus, containing our detailed // The following sends a message of type Error on the bus, containing our detailed
// error information. // error information.
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
gst_element_error!( element_error!(
dbin, dbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to insert sink"), ("Failed to insert sink"),
@ -219,7 +219,7 @@ fn example_main() -> Result<(), Error> {
); );
#[cfg(not(feature = "v1_10"))] #[cfg(not(feature = "v1_10"))]
gst_element_error!( element_error!(
dbin, dbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to insert sink"), ("Failed to insert sink"),

View file

@ -12,8 +12,8 @@
// {uridecodebin} -| {encodebin}-{filesink} // {uridecodebin} -| {encodebin}-{filesink}
// \-{queue}-{videoconvert}-{videoscale}----/ // \-{queue}-{videoconvert}-{videoscale}----/
use gst::gst_element_error; use gst::element_error;
use gst::gst_element_warning; use gst::element_warning;
use gst::prelude::*; use gst::prelude::*;
use gst_pbutils::prelude::*; use gst_pbutils::prelude::*;
@ -156,7 +156,7 @@ fn example_main() -> Result<(), Error> {
match media_type { match media_type {
None => { None => {
gst_element_warning!( element_warning!(
dbin, dbin,
gst::CoreError::Negotiation, gst::CoreError::Negotiation,
( (
@ -245,7 +245,7 @@ fn example_main() -> Result<(), Error> {
if let Err(err) = link_to_encodebin(is_audio, is_video) { if let Err(err) = link_to_encodebin(is_audio, is_video) {
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
gst_element_error!( element_error!(
dbin, dbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to insert sink"), ("Failed to insert sink"),
@ -256,7 +256,7 @@ fn example_main() -> Result<(), Error> {
); );
#[cfg(not(feature = "v1_10"))] #[cfg(not(feature = "v1_10"))]
gst_element_error!( element_error!(
dbin, dbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to insert sink"), ("Failed to insert sink"),

View file

@ -4,7 +4,7 @@
// {videotestsrc} - { glsinkbin } // {videotestsrc} - { glsinkbin }
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
use gst_gl::prelude::*; use gst_gl::prelude::*;
@ -474,7 +474,7 @@ impl App {
{ {
let _buffer = sample.get_buffer().ok_or_else(|| { let _buffer = sample.get_buffer().ok_or_else(|| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to get buffer from appsink") ("Failed to get buffer from appsink")
@ -487,7 +487,7 @@ impl App {
.get_caps() .get_caps()
.and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok()) .and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok())
.ok_or_else(|| { .ok_or_else(|| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to get video info from sample") ("Failed to get video info from sample")

View file

@ -1,4 +1,4 @@
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
use std::env; use std::env;
@ -195,7 +195,7 @@ fn example_main() -> Result<(), Error> {
match make_fec_decoder(&rtpbin, sess_id) { match make_fec_decoder(&rtpbin, sess_id) {
Ok(elem) => Some(elem.to_value()), Ok(elem) => Some(elem.to_value()),
Err(err) => { Err(err) => {
gst_element_error!( element_error!(
rtpbin, rtpbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to make FEC decoder"), ("Failed to make FEC decoder"),
@ -220,7 +220,7 @@ fn example_main() -> Result<(), Error> {
match connect_rtpbin_srcpad(&src_pad, &depay) { match connect_rtpbin_srcpad(&src_pad, &depay) {
Ok(_) => (), Ok(_) => (),
Err(err) => { Err(err) => {
gst_element_error!( element_error!(
rtpbin, rtpbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to link srcpad"), ("Failed to link srcpad"),

View file

@ -1,4 +1,4 @@
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
#[path = "../examples-common.rs"] #[path = "../examples-common.rs"]
@ -115,7 +115,7 @@ fn example_main() -> Result<(), Error> {
match make_fec_encoder(fec_percentage) { match make_fec_encoder(fec_percentage) {
Ok(elem) => Some(elem.to_value()), Ok(elem) => Some(elem.to_value()),
Err(err) => { Err(err) => {
gst_element_error!( element_error!(
rtpbin, rtpbin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to make FEC encoder"), ("Failed to make FEC encoder"),
@ -138,7 +138,7 @@ fn example_main() -> Result<(), Error> {
move |decodebin, src_pad| match connect_decodebin_pad(&src_pad, &conv) { move |decodebin, src_pad| match connect_decodebin_pad(&src_pad, &conv) {
Ok(_) => (), Ok(_) => (),
Err(err) => { Err(err) => {
gst_element_error!( element_error!(
decodebin, decodebin,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to link decodebin srcpad"), ("Failed to link decodebin srcpad"),

View file

@ -6,10 +6,8 @@
// Our filter can only handle F32 mono and acts as a FIR filter. The filter impulse response / // 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>. // coefficients are provided via Rust API on the filter as a Vec<f32>.
use gst::gst_element_error;
use gst::gst_info;
use gst::gst_trace;
use gst::prelude::*; use gst::prelude::*;
use gst::{element_error, gst_info, gst_trace};
use anyhow::Error; use anyhow::Error;
use derive_more::{Display, Error}; use derive_more::{Display, Error};
@ -192,7 +190,7 @@ mod fir_filter {
// Try mapping the input buffer as writable // Try mapping the input buffer as writable
let mut data = buf.map_writable().map_err(|_| { let mut data = buf.map_writable().map_err(|_| {
gst_element_error!( element_error!(
element, element,
gst::CoreError::Failed, gst::CoreError::Failed,
["Failed to map input buffer readable"] ["Failed to map input buffer readable"]
@ -202,7 +200,7 @@ mod fir_filter {
// And reinterprete it as a slice of f32 // And reinterprete it as a slice of f32
let samples = data.as_mut_slice_of::<f32>().map_err(|err| { let samples = data.as_mut_slice_of::<f32>().map_err(|err| {
gst_element_error!( element_error!(
element, element,
gst::CoreError::Failed, gst::CoreError::Failed,
["Failed to cast input buffer as f32 slice: {}", err] ["Failed to cast input buffer as f32 slice: {}", err]

View file

@ -6,7 +6,7 @@
// The appsink enforces RGBA so that the image crate can use it. The image crate also requires // The appsink enforces RGBA so that the image crate can use it. The image crate also requires
// tightly packed pixels, which is the case for RGBA by default in GStreamer. // tightly packed pixels, which is the case for RGBA by default in GStreamer.
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
use anyhow::Error; use anyhow::Error;
@ -69,7 +69,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
// Pull the sample in question out of the appsink's buffer. // Pull the sample in question out of the appsink's buffer.
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.get_buffer().ok_or_else(|| { let buffer = sample.get_buffer().ok_or_else(|| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to get buffer from appsink") ("Failed to get buffer from appsink")
@ -95,7 +95,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
// So mapping the buffer makes the underlying memory region accessible to us. // So mapping the buffer makes the underlying memory region accessible to us.
// See: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/allocation.html // See: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/allocation.html
let map = buffer.map_readable().map_err(|_| { let map = buffer.map_readable().map_err(|_| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Failed, gst::ResourceError::Failed,
("Failed to map buffer readable") ("Failed to map buffer readable")
@ -129,7 +129,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
// Save it at the specific location. This automatically detects the file type // Save it at the specific location. This automatically detects the file type
// based on the filename. // based on the filename.
scaled_img.save(&out_path).map_err(|err| { scaled_img.save(&out_path).map_err(|err| {
gst_element_error!( element_error!(
appsink, appsink,
gst::ResourceError::Write, gst::ResourceError::Write,
( (

View file

@ -17,7 +17,7 @@
// {src} - {typefind} - {demuxer} -| {multiqueue} - {matroskamux} - {filesink} // {src} - {typefind} - {demuxer} -| {multiqueue} - {matroskamux} - {filesink}
// \-[video]-/ // \-[video]-/
use gst::gst_element_error; use gst::element_error;
use gst::prelude::*; use gst::prelude::*;
use std::env; use std::env;
@ -221,7 +221,7 @@ fn handle_demux_pad_added(
}; };
if let Err(err) = link_to_muxer() { if let Err(err) = link_to_muxer() {
gst_element_error!( element_error!(
demuxer, demuxer,
gst::LibraryError::Failed, gst::LibraryError::Failed,
("Failed to insert sink"), ("Failed to insert sink"),

View file

@ -138,11 +138,11 @@ impl AppSinkCallbacksBuilder {
fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) { fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) {
skip_assert_initialized!(); skip_assert_initialized!();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else { } else {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
} }
} }
@ -152,7 +152,7 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -179,7 +179,7 @@ unsafe extern "C" fn trampoline_new_preroll(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return gst::FlowReturn::Error.to_glib(); return gst::FlowReturn::Error.to_glib();
} }
@ -212,7 +212,7 @@ unsafe extern "C" fn trampoline_new_sample(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return gst::FlowReturn::Error.to_glib(); return gst::FlowReturn::Error.to_glib();
} }

View file

@ -111,11 +111,11 @@ impl AppSrcCallbacksBuilder {
fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) { fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) {
skip_assert_initialized!(); skip_assert_initialized!();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else { } else {
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
} }
} }
@ -129,7 +129,7 @@ unsafe extern "C" fn trampoline_need_data(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -153,7 +153,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -179,7 +179,7 @@ unsafe extern "C" fn trampoline_seek_data(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]);
return false.to_glib(); return false.to_glib();
} }

View file

@ -173,7 +173,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
} }
#[macro_export] #[macro_export]
macro_rules! gst_audio_decoder_error( macro_rules! audio_decoder_error(
($obj:expr, $weight:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($obj:expr, $weight:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::AudioDecoderExtManual; use $crate::AudioDecoderExtManual;
$obj.error( $obj.error(

View file

@ -177,7 +177,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `open` failed"] ["Parent function `open` failed"]
)) ))
@ -201,7 +201,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `close` failed"] ["Parent function `close` failed"]
)) ))
@ -225,7 +225,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -249,7 +249,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -270,7 +270,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
(*parent_class) (*parent_class)
.set_format .set_format
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0, element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0,
caps.to_glib_none().0 caps.to_glib_none().0
@ -389,7 +389,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0), f(element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `negotiate` failed" "Parent function `negotiate` failed"
@ -492,7 +492,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `propose_allocation` failed"] ["Parent function `propose_allocation` failed"]
)) ))
@ -519,7 +519,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `decide_allocation` failed"] ["Parent function `decide_allocation` failed"]
)) ))
@ -567,7 +567,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -589,7 +589,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -611,7 +611,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -633,7 +633,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -656,7 +656,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -681,7 +681,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) { match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) {
Ok((new_offset, new_len)) => { Ok((new_offset, new_len)) => {
assert!(new_offset <= std::i32::MAX as u32); assert!(new_offset <= std::i32::MAX as u32);
@ -710,7 +710,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.handle_frame( imp.handle_frame(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(), Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
@ -731,7 +731,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
Ok(Some(new_buffer)) => { Ok(Some(new_buffer)) => {
*buffer = new_buffer.into_ptr(); *buffer = new_buffer.into_ptr();
@ -758,7 +758,7 @@ unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>(
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard)) AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard))
}) })
} }
@ -773,7 +773,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -796,7 +796,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
AudioDecoderImpl::get_caps( AudioDecoderImpl::get_caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -819,7 +819,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -836,7 +836,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -853,7 +853,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -870,7 +870,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -888,7 +888,7 @@ where
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -912,7 +912,7 @@ where
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -163,7 +163,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `open` failed"] ["Parent function `open` failed"]
)) ))
@ -187,7 +187,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `close` failed"] ["Parent function `close` failed"]
)) ))
@ -211,7 +211,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -235,7 +235,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -256,7 +256,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
(*parent_class) (*parent_class)
.set_format .set_format
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<AudioEncoder>().to_glib_none().0, element.unsafe_cast_ref::<AudioEncoder>().to_glib_none().0,
info.to_glib_none().0 as *mut _ info.to_glib_none().0 as *mut _
@ -335,7 +335,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(element.unsafe_cast_ref::<AudioEncoder>().to_glib_none().0), f(element.unsafe_cast_ref::<AudioEncoder>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `negotiate` failed" "Parent function `negotiate` failed"
@ -438,7 +438,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `propose_allocation` failed"] ["Parent function `propose_allocation` failed"]
)) ))
@ -465,7 +465,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `decide_allocation` failed"] ["Parent function `decide_allocation` failed"]
)) ))
@ -512,7 +512,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -534,7 +534,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -556,7 +556,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -578,7 +578,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -601,7 +601,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -626,7 +626,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.handle_frame( imp.handle_frame(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(), Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
@ -647,7 +647,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
Ok(Some(new_buffer)) => { Ok(Some(new_buffer)) => {
*buffer = new_buffer.into_ptr(); *buffer = new_buffer.into_ptr();
@ -672,7 +672,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
} }
@ -687,7 +687,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -710,7 +710,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
AudioEncoderImpl::get_caps( AudioEncoderImpl::get_caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -733,7 +733,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -750,7 +750,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -767,7 +767,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -784,7 +784,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -802,7 +802,7 @@ where
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -826,7 +826,7 @@ where
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -68,7 +68,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
None => return Ok(()), None => return Ok(()),
Some(f) => f, Some(f) => f,
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0), f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to close element using the parent function" "Failed to close element using the parent function"
@ -96,7 +96,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
Some(f) => f, Some(f) => f,
None => return Ok(()), None => return Ok(()),
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0), f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to open element using the parent function" "Failed to open element using the parent function"
@ -116,7 +116,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
Some(f) => f, Some(f) => f,
None => return Ok(()), None => return Ok(()),
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0, sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0,
&mut spec.0 &mut spec.0
@ -134,13 +134,13 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
let f = match (*parent_class).unprepare { let f = match (*parent_class).unprepare {
Some(f) => f, Some(f) => f,
None => { None => {
return Err(gst::gst_loggable_error!( return Err(gst::loggable_error!(
gst::CAT_RUST, gst::CAT_RUST,
"Unprepare is not implemented!" "Unprepare is not implemented!"
)) ))
} }
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0), f(sink.unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to unprepare element using the parent function" "Failed to unprepare element using the parent function"
@ -165,7 +165,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
if ret > 0 { if ret > 0 {
Ok(ret) Ok(ret)
} else { } else {
Err(gst::gst_loggable_error!( Err(gst::loggable_error!(
gst::CAT_RUST, gst::CAT_RUST,
"Failed to write using the parent function" "Failed to write using the parent function"
)) ))
@ -211,7 +211,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -231,7 +231,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), 0, { gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
imp.delay(wrap.unsafe_cast_ref()) imp.delay(wrap.unsafe_cast_ref())
}) })
} }
@ -246,7 +246,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -271,7 +271,7 @@ where
let spec = &mut *(spec as *mut AudioRingBufferSpec); let spec = &mut *(spec as *mut AudioRingBufferSpec);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -293,7 +293,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unprepare(wrap.unsafe_cast_ref()) { match imp.unprepare(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -318,7 +318,7 @@ where
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize); let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), -1, { gst::panic_to_error!(&wrap, &instance.panicked(), -1, {
imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1) imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1)
}) })
} }
@ -331,7 +331,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
imp.reset(wrap.unsafe_cast_ref()); imp.reset(wrap.unsafe_cast_ref());
}); });
} }

View file

@ -78,7 +78,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
None => return Ok(()), None => return Ok(()),
Some(f) => f, Some(f) => f,
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0), f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to close element using the parent function" "Failed to close element using the parent function"
@ -106,7 +106,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
Some(f) => f, Some(f) => f,
None => return Ok(()), None => return Ok(()),
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0), f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to open element using the parent function" "Failed to open element using the parent function"
@ -126,7 +126,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
Some(f) => f, Some(f) => f,
None => return Ok(()), None => return Ok(()),
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0, src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0,
&mut spec.0 &mut spec.0
@ -144,13 +144,13 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
let f = match (*parent_class).unprepare { let f = match (*parent_class).unprepare {
Some(f) => f, Some(f) => f,
None => { None => {
return Err(gst::gst_loggable_error!( return Err(gst::loggable_error!(
gst::CAT_RUST, gst::CAT_RUST,
"Unprepare is not implemented!" "Unprepare is not implemented!"
)) ))
} }
}; };
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0), f(src.unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Failed to unprepare element using the parent function" "Failed to unprepare element using the parent function"
@ -181,7 +181,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
if ret > 0 { if ret > 0 {
Ok((ret, from_glib(timestamp.assume_init()))) Ok((ret, from_glib(timestamp.assume_init())))
} else { } else {
Err(gst::gst_loggable_error!( Err(gst::loggable_error!(
gst::CAT_RUST, gst::CAT_RUST,
"Failed to read using the parent function" "Failed to read using the parent function"
)) ))
@ -227,7 +227,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -247,7 +247,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), 0, { gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
imp.delay(wrap.unsafe_cast_ref()) imp.delay(wrap.unsafe_cast_ref())
}) })
} }
@ -262,7 +262,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -287,7 +287,7 @@ where
let spec = &mut *(spec as *mut AudioRingBufferSpec); let spec = &mut *(spec as *mut AudioRingBufferSpec);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -309,7 +309,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unprepare(wrap.unsafe_cast_ref()) { match imp.unprepare(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -335,7 +335,7 @@ where
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize); let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), 0, { gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
let (res, timestamp_res) = imp let (res, timestamp_res) = imp
.read(wrap.unsafe_cast_ref(), data_slice) .read(wrap.unsafe_cast_ref(), data_slice)
.unwrap_or((0, gst::CLOCK_TIME_NONE)); .unwrap_or((0, gst::CLOCK_TIME_NONE));
@ -353,7 +353,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
imp.reset(wrap.unsafe_cast_ref()); imp.reset(wrap.unsafe_cast_ref());
}); });
} }

View file

@ -483,7 +483,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
match (*parent_class).src_activate { match (*parent_class).src_activate {
None => Ok(()), None => Ok(()),
Some(f) => gst::gst_result_from_gboolean!( Some(f) => gst::result_from_gboolean!(
f( f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0, aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
mode.to_glib(), mode.to_glib(),
@ -529,7 +529,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -553,7 +553,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -649,7 +649,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
(*parent_class) (*parent_class)
.negotiated_src_caps .negotiated_src_caps
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0, aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
caps.to_glib_none().0 caps.to_glib_none().0
@ -747,7 +747,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.flush(wrap.unsafe_cast_ref()).into() imp.flush(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .to_glib()
@ -765,7 +765,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
let ret = gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { let ret = gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.clip( imp.clip(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -787,7 +787,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer)) imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
.into() .into()
}) })
@ -807,7 +807,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list)) imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
.into() .into()
}) })
@ -826,7 +826,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(wrap, &instance.panicked(), false, { gst::panic_to_error!(wrap, &instance.panicked(), false, {
imp.sink_event( imp.sink_event(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -850,7 +850,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.sink_event_pre_queue( imp.sink_event_pre_queue(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -873,7 +873,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query( imp.sink_query(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -897,7 +897,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query_pre_queue( imp.sink_query_pre_queue(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -918,7 +918,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -935,7 +935,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -953,7 +953,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) { match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -976,7 +976,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout)) imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
.into() .into()
}) })
@ -993,7 +993,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -1015,7 +1015,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -1037,7 +1037,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
imp.get_next_time(wrap.unsafe_cast_ref()) imp.get_next_time(wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
@ -1056,7 +1056,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { gst::panic_to_error!(&wrap, &instance.panicked(), None, {
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name); let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
imp.create_new_pad( imp.create_new_pad(
@ -1085,7 +1085,7 @@ where
*res = ptr::null_mut(); *res = ptr::null_mut();
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(res_caps) => { Ok(res_caps) => {
*res = res_caps.into_ptr(); *res = res_caps.into_ptr();
@ -1108,7 +1108,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps)) imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
}) })
.into_ptr() .into_ptr()
@ -1125,7 +1125,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -1149,7 +1149,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref()) imp.negotiate(wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
@ -1168,7 +1168,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad)) imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad))
}) })
.to_glib_full() .to_glib_full()

View file

@ -84,7 +84,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -104,7 +104,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -131,7 +131,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `set_sink_caps` failed"] ["Parent function `set_sink_caps` failed"]
)) ))
@ -228,7 +228,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -250,7 +250,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -274,7 +274,7 @@ where
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps); let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -299,7 +299,7 @@ where
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let wrap_frame = BaseParseFrame::new(frame, &wrap); let wrap_frame = BaseParseFrame::new(frame, &wrap);
let res = gst::gst_panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), { let res = gst::panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), {
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame) imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
}); });
@ -328,7 +328,7 @@ where
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value); let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
let res = gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { let res = gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format)) imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
}); });

View file

@ -143,7 +143,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -163,7 +163,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -331,7 +331,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
(*parent_class) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0, element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
caps.to_glib_none().0 caps.to_glib_none().0
@ -369,7 +369,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `unlock` failed"] ["Parent function `unlock` failed"]
)) ))
@ -389,7 +389,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `unlock_stop` failed"] ["Parent function `unlock_stop` failed"]
)) ))
@ -433,7 +433,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -455,7 +455,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -479,7 +479,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.render(wrap.unsafe_cast_ref(), &buffer).into() imp.render(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .to_glib()
@ -497,7 +497,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into() imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .to_glib()
@ -515,7 +515,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let list = from_glib_borrow(list); let list = from_glib_borrow(list);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.render_list(wrap.unsafe_cast_ref(), &list).into() imp.render_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.to_glib() .to_glib()
@ -533,7 +533,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let list = from_glib_borrow(list); let list = from_glib_borrow(list);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into() imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.to_glib() .to_glib()
@ -551,7 +551,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query_ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.to_glib() .to_glib()
@ -568,7 +568,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr)) imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
}) })
.to_glib() .to_glib()
@ -586,7 +586,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let filter = Option::<gst::Caps>::from_glib_borrow(filter); let filter = Option::<gst::Caps>::from_glib_borrow(filter);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
}) })
.map(|caps| caps.into_ptr()) .map(|caps| caps.into_ptr())
@ -605,7 +605,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let caps = from_glib_borrow(caps); let caps = from_glib_borrow(caps);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -629,7 +629,7 @@ where
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let caps = from_glib_full(caps); let caps = from_glib_full(caps);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
imp.fixate(wrap.unsafe_cast_ref(), caps) imp.fixate(wrap.unsafe_cast_ref(), caps)
}) })
.into_ptr() .into_ptr()
@ -645,7 +645,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unlock(wrap.unsafe_cast_ref()) { match imp.unlock(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -667,7 +667,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unlock_stop(wrap.unsafe_cast_ref()) { match imp.unlock_stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -5,6 +5,7 @@ use glib::subclass::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error};
use std::mem; use std::mem;
use std::ptr; use std::ptr;
@ -184,7 +185,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -204,7 +205,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -365,7 +366,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
if buffer_ptr != orig_buffer_ptr { if buffer_ptr != orig_buffer_ptr {
let new_buffer = gst::BufferRef::from_ptr(buffer_ptr); let new_buffer = gst::BufferRef::from_ptr(buffer_ptr);
gst::gst_debug!( gst_debug!(
gst::CAT_PERFORMANCE, gst::CAT_PERFORMANCE,
obj: element.unsafe_cast_ref::<BaseSrc>(), obj: element.unsafe_cast_ref::<BaseSrc>(),
"Returned new buffer from parent create function, copying into passed buffer" "Returned new buffer from parent create function, copying into passed buffer"
@ -374,7 +375,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
let mut map = match passed_buffer.map_writable() { let mut map = match passed_buffer.map_writable() {
Ok(map) => map, Ok(map) => map,
Err(_) => { Err(_) => {
gst::gst_error!( gst_error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: element.unsafe_cast_ref::<BaseSrc>(), obj: element.unsafe_cast_ref::<BaseSrc>(),
"Failed to map passed buffer writable" "Failed to map passed buffer writable"
@ -393,7 +394,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
match new_buffer.copy_into(passed_buffer, gst::BUFFER_COPY_METADATA, 0, None) { match new_buffer.copy_into(passed_buffer, gst::BUFFER_COPY_METADATA, 0, None) {
Ok(_) => Ok(CreateSuccess::FilledBuffer), Ok(_) => Ok(CreateSuccess::FilledBuffer),
Err(_) => { Err(_) => {
gst::gst_error!( gst_error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: element.unsafe_cast_ref::<BaseSrc>(), obj: element.unsafe_cast_ref::<BaseSrc>(),
"Failed to copy buffer metadata" "Failed to copy buffer metadata"
@ -489,7 +490,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0), f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `negotiate` failed" "Parent function `negotiate` failed"
@ -510,7 +511,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0, element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
caps.to_glib_none().0 caps.to_glib_none().0
@ -548,7 +549,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `unlock` failed"] ["Parent function `unlock` failed"]
)) ))
@ -568,7 +569,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) { if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::Failed, gst::CoreError::Failed,
["Parent function `unlock_stop` failed"] ["Parent function `unlock_stop` failed"]
)) ))
@ -616,7 +617,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -636,7 +637,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -658,7 +659,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.is_seekable(wrap.unsafe_cast_ref()) imp.is_seekable(wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
@ -675,7 +676,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.get_size(wrap.unsafe_cast_ref()) { match imp.get_size(wrap.unsafe_cast_ref()) {
Some(s) => { Some(s) => {
*size = s; *size = s;
@ -703,7 +704,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
*start = gst::ffi::GST_CLOCK_TIME_NONE; *start = gst::ffi::GST_CLOCK_TIME_NONE;
*stop = gst::ffi::GST_CLOCK_TIME_NONE; *stop = gst::ffi::GST_CLOCK_TIME_NONE;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer); let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer);
*start = start_.to_glib(); *start = start_.to_glib();
*stop = stop_.to_glib(); *stop = stop_.to_glib();
@ -724,7 +725,7 @@ where
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let buffer = gst::BufferRef::from_mut_ptr(buffer); let buffer = gst::BufferRef::from_mut_ptr(buffer);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer) imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
.into() .into()
}) })
@ -747,7 +748,7 @@ where
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.alloc(wrap.unsafe_cast_ref(), offset, length) { match imp.alloc(wrap.unsafe_cast_ref(), offset, length) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();
@ -781,7 +782,7 @@ where
Some(gst::BufferRef::from_mut_ptr(*buffer_ptr)) Some(gst::BufferRef::from_mut_ptr(*buffer_ptr))
}; };
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.create( match imp.create(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
offset, offset,
@ -791,7 +792,7 @@ where
Ok(CreateSuccess::NewBuffer(new_buffer)) => { Ok(CreateSuccess::NewBuffer(new_buffer)) => {
if let Some(passed_buffer) = buffer { if let Some(passed_buffer) = buffer {
if passed_buffer.as_ptr() != new_buffer.as_ptr() { if passed_buffer.as_ptr() != new_buffer.as_ptr() {
gst::gst_debug!( gst_debug!(
gst::CAT_PERFORMANCE, gst::CAT_PERFORMANCE,
obj: &*wrap, obj: &*wrap,
"Returned new buffer from create function, copying into passed buffer" "Returned new buffer from create function, copying into passed buffer"
@ -800,7 +801,7 @@ where
let mut map = match passed_buffer.map_writable() { let mut map = match passed_buffer.map_writable() {
Ok(map) => map, Ok(map) => map,
Err(_) => { Err(_) => {
gst::gst_error!( gst_error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"Failed to map passed buffer writable" "Failed to map passed buffer writable"
@ -824,7 +825,7 @@ where
) { ) {
Ok(_) => gst::FlowReturn::Ok, Ok(_) => gst::FlowReturn::Ok,
Err(_) => { Err(_) => {
gst::gst_error!( gst_error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"Failed to copy buffer metadata" "Failed to copy buffer metadata"
@ -859,7 +860,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
let mut s = from_glib_none(segment); let mut s = from_glib_none(segment);
let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s); let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s);
ptr::write(segment, *(s.to_glib_none().0)); ptr::write(segment, *(s.to_glib_none().0));
@ -881,7 +882,7 @@ where
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query_ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.to_glib() .to_glib()
@ -898,7 +899,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr)) imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
}) })
.to_glib() .to_glib()
@ -916,7 +917,7 @@ where
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let filter = Option::<gst::Caps>::from_glib_borrow(filter); let filter = Option::<gst::Caps>::from_glib_borrow(filter);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
}) })
.map(|caps| caps.into_ptr()) .map(|caps| caps.into_ptr())
@ -933,7 +934,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -957,7 +958,7 @@ where
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let caps = from_glib_borrow(caps); let caps = from_glib_borrow(caps);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -981,7 +982,7 @@ where
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let caps = from_glib_full(caps); let caps = from_glib_full(caps);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
imp.fixate(wrap.unsafe_cast_ref(), caps) imp.fixate(wrap.unsafe_cast_ref(), caps)
}) })
.into_ptr() .into_ptr()
@ -997,7 +998,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unlock(wrap.unsafe_cast_ref()) { match imp.unlock(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -1019,7 +1020,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.unlock_stop(wrap.unsafe_cast_ref()) { match imp.unlock_stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -5,6 +5,7 @@ use crate::prelude::*;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::gst_warning;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use std::mem; use std::mem;
@ -301,7 +302,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -325,7 +326,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -393,7 +394,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
(*parent_class) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
incaps.to_glib_none().0, incaps.to_glib_none().0,
@ -685,7 +686,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass;
if let Some(ref f) = (*parent_class).copy_metadata { if let Some(ref f) = (*parent_class).copy_metadata {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
inbuf.as_ptr() as *mut _, inbuf.as_ptr() as *mut _,
@ -920,7 +921,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -942,7 +943,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -967,7 +968,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, { gst::panic_to_error!(&wrap, &instance.panicked(), None, {
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter); let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
imp.transform_caps( imp.transform_caps(
@ -994,7 +995,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
imp.fixate_caps( imp.fixate_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -1017,7 +1018,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_caps( match imp.set_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(incaps), &from_glib_borrow(incaps),
@ -1045,7 +1046,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.accept_caps( imp.accept_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -1067,7 +1068,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
BaseTransformImpl::query( BaseTransformImpl::query(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -1093,7 +1094,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.transform_size( match imp.transform_size(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -1123,7 +1124,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Some(s) => { Some(s) => {
*size = s; *size = s;
@ -1150,7 +1151,7 @@ where
// FIXME: Wrong signature in FFI // FIXME: Wrong signature in FFI
let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer; let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) { match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) {
Ok(PrepareOutputBufferSuccess::InputBuffer) => { Ok(PrepareOutputBufferSuccess::InputBuffer) => {
*outbuf = inbuf; *outbuf = inbuf;
@ -1177,7 +1178,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -1194,7 +1195,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -1212,7 +1213,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.transform( imp.transform(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(inbuf), &from_glib_borrow(inbuf),
@ -1237,7 +1238,7 @@ where
// FIXME: Wrong signature in FFI // FIXME: Wrong signature in FFI
let buf = buf as *mut gst::ffi::GstBuffer; let buf = buf as *mut gst::ffi::GstBuffer;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) { if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) {
imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf)) imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf))
.into() .into()
@ -1264,7 +1265,7 @@ where
let inbuf = gst::BufferRef::from_ptr(inbuf); let inbuf = gst::BufferRef::from_ptr(inbuf);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.transform_meta( imp.transform_meta(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
gst::BufferRef::from_mut_ptr(outbuf), gst::BufferRef::from_mut_ptr(outbuf),
@ -1288,7 +1289,7 @@ where
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE { if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE {
gst::gst_warning!( gst_warning!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"buffer {:?} not writable", "buffer {:?} not writable",
@ -1297,7 +1298,7 @@ where
return glib::ffi::GFALSE; return glib::ffi::GFALSE;
} }
gst::gst_panic_to_error!(&wrap, &instance.panicked(), true, { gst::panic_to_error!(&wrap, &instance.panicked(), true, {
match imp.copy_metadata( match imp.copy_metadata(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
gst::BufferRef::from_ptr(inbuf), gst::BufferRef::from_ptr(inbuf),
@ -1323,7 +1324,7 @@ unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), { gst::panic_to_error!(&wrap, &instance.panicked(), (), {
imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)); imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf));
}) })
} }
@ -1340,7 +1341,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.submit_input_buffer( imp.submit_input_buffer(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(is_discont), from_glib(is_discont),
@ -1364,7 +1365,7 @@ where
*buf = ptr::null_mut(); *buf = ptr::null_mut();
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.generate_output(wrap.unsafe_cast_ref()) { match imp.generate_output(wrap.unsafe_cast_ref()) {
Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(), Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(),
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok, Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,

View file

@ -135,7 +135,7 @@ where
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr); let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
let buffer = gst::BufferRef::from_mut_ptr(buffer); let buffer = gst::BufferRef::from_mut_ptr(buffer);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into() PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
}) })
.to_glib() .to_glib()
@ -155,7 +155,7 @@ where
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) { match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();
@ -181,7 +181,7 @@ where
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) { match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();

View file

@ -2,7 +2,7 @@
use glib::translate::*; use glib::translate::*;
gst::gst_define_mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || { gst::mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || {
ffi::gst_rtsp_thread_get_type() ffi::gst_rtsp_thread_get_type()
}); });

View file

@ -5,7 +5,7 @@ use glib::value::ToSendValue;
use std::fmt; use std::fmt;
gst::gst_define_mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, || { gst::mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, || {
ffi::gst_rtsp_token_get_type() ffi::gst_rtsp_token_get_type()
}); });

View file

@ -374,7 +374,7 @@ impl<T: RTSPClientImpl> RTSPClientImplExt for T {
"No `configure_client_media` virtual method implementation in parent class", "No `configure_client_media` virtual method implementation in parent class",
); );
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
client.unsafe_cast_ref::<RTSPClient>().to_glib_none().0, client.unsafe_cast_ref::<RTSPClient>().to_glib_none().0,
media.to_glib_none().0, media.to_glib_none().0,
@ -629,7 +629,7 @@ impl<T: RTSPClientImpl> RTSPClientImplExt for T {
.handle_sdp .handle_sdp
.expect("No `handle_sdp` virtual method implementation in parent class"); .expect("No `handle_sdp` virtual method implementation in parent class");
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
client.unsafe_cast_ref::<RTSPClient>().to_glib_none().0, client.unsafe_cast_ref::<RTSPClient>().to_glib_none().0,
ctx.to_glib_none().0, ctx.to_glib_none().0,

View file

@ -174,7 +174,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass;
if let Some(f) = (*parent_class).prepare { if let Some(f) = (*parent_class).prepare {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0,
thread.to_glib_none().0 thread.to_glib_none().0
@ -193,7 +193,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass;
if let Some(f) = (*parent_class).unprepare { if let Some(f) = (*parent_class).unprepare {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0), f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `unprepare` failed" "Parent function `unprepare` failed"
@ -209,7 +209,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass;
if let Some(f) = (*parent_class).suspend { if let Some(f) = (*parent_class).suspend {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0), f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `suspend` failed" "Parent function `suspend` failed"
@ -225,7 +225,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass;
if let Some(f) = (*parent_class).unsuspend { if let Some(f) = (*parent_class).unsuspend {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0), f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `unsuspend` failed" "Parent function `unsuspend` failed"
@ -310,7 +310,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
// The C code assumes to pass a floating reference around so let's make sure we do // The C code assumes to pass a floating reference around so let's make sure we do
glib::gobject_ffi::g_object_force_floating(ptr as *mut _); glib::gobject_ffi::g_object_force_floating(ptr as *mut _);
let res = gst::gst_result_from_gboolean!( let res = gst::result_from_gboolean!(
f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, ptr), f(media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, ptr),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `setup_sdp` failed" "Parent function `setup_sdp` failed"
@ -343,7 +343,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
.setup_sdp .setup_sdp
.expect("No `setup_sdp` virtual method implementation in parent class"); .expect("No `setup_sdp` virtual method implementation in parent class");
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0,
sdp as *mut _ as *mut gst_sdp::ffi::GstSDPMessage, sdp as *mut _ as *mut gst_sdp::ffi::GstSDPMessage,
@ -439,7 +439,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
.handle_sdp .handle_sdp
.expect("No `handle_sdp` virtual method implementation in parent class"); .expect("No `handle_sdp` virtual method implementation in parent class");
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0,
sdp as *const _ as *mut gst_sdp::ffi::GstSDPMessage sdp as *const _ as *mut gst_sdp::ffi::GstSDPMessage

View file

@ -182,7 +182,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `open` failed"] ["Parent function `open` failed"]
)) ))
@ -206,7 +206,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `close` failed"] ["Parent function `close` failed"]
)) ))
@ -230,7 +230,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -254,7 +254,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -309,7 +309,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
(*parent_class) (*parent_class)
.set_format .set_format
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0, element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0,
state.as_mut_ptr() state.as_mut_ptr()
@ -391,7 +391,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0), f(element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `negotiate` failed" "Parent function `negotiate` failed"
@ -494,7 +494,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `propose_allocation` failed"] ["Parent function `propose_allocation` failed"]
)) ))
@ -521,7 +521,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `decide_allocation` failed"] ["Parent function `decide_allocation` failed"]
)) ))
@ -570,7 +570,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -592,7 +592,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -614,7 +614,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -636,7 +636,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -658,7 +658,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .to_glib()
@ -674,7 +674,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.drain(wrap.unsafe_cast_ref()).into() imp.drain(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .to_glib()
@ -693,7 +693,7 @@ where
ffi::gst_video_codec_state_ref(state); ffi::gst_video_codec_state_ref(state);
let wrap_state = VideoCodecState::<Readable>::new(state); let wrap_state = VideoCodecState::<Readable>::new(state);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -722,7 +722,7 @@ where
let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter); let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter);
let at_eos: bool = from_glib(at_eos); let at_eos: bool = from_glib(at_eos);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos) imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos)
.into() .into()
}) })
@ -741,7 +741,7 @@ where
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let wrap_frame = VideoCodecFrame::new(frame, &*wrap); let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.to_glib() .to_glib()
@ -757,7 +757,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
@ -773,7 +773,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -796,7 +796,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
VideoDecoderImpl::get_caps( VideoDecoderImpl::get_caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -819,7 +819,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -836,7 +836,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -853,7 +853,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -870,7 +870,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -888,7 +888,7 @@ where
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -912,7 +912,7 @@ where
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -158,7 +158,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `open` failed"] ["Parent function `open` failed"]
)) ))
@ -182,7 +182,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `close` failed"] ["Parent function `close` failed"]
)) ))
@ -206,7 +206,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `start` failed"] ["Parent function `start` failed"]
)) ))
@ -230,7 +230,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
{ {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `stop` failed"] ["Parent function `stop` failed"]
)) ))
@ -268,7 +268,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
(*parent_class) (*parent_class)
.set_format .set_format
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f( f(
element.unsafe_cast_ref::<VideoEncoder>().to_glib_none().0, element.unsafe_cast_ref::<VideoEncoder>().to_glib_none().0,
state.as_mut_ptr() state.as_mut_ptr()
@ -325,7 +325,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
gst::gst_result_from_gboolean!( gst::result_from_gboolean!(
f(element.unsafe_cast_ref::<VideoEncoder>().to_glib_none().0), f(element.unsafe_cast_ref::<VideoEncoder>().to_glib_none().0),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `negotiate` failed" "Parent function `negotiate` failed"
@ -428,7 +428,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `propose_allocation` failed"] ["Parent function `propose_allocation` failed"]
)) ))
@ -455,7 +455,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
)) { )) {
Ok(()) Ok(())
} else { } else {
Err(gst::gst_error_msg!( Err(gst::error_msg!(
gst::CoreError::StateChange, gst::CoreError::StateChange,
["Parent function `decide_allocation` failed"] ["Parent function `decide_allocation` failed"]
)) ))
@ -502,7 +502,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -524,7 +524,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -546,7 +546,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -568,7 +568,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -590,7 +590,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .to_glib()
@ -609,7 +609,7 @@ where
ffi::gst_video_codec_state_ref(state); ffi::gst_video_codec_state_ref(state);
let wrap_state = VideoCodecState::<Readable>::new(state); let wrap_state = VideoCodecState::<Readable>::new(state);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -633,7 +633,7 @@ where
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let wrap_frame = VideoCodecFrame::new(frame, &*wrap); let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.to_glib() .to_glib()
@ -649,7 +649,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
@ -665,7 +665,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -688,7 +688,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
VideoEncoderImpl::get_caps( VideoEncoderImpl::get_caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -711,7 +711,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -728,7 +728,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -745,7 +745,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -762,7 +762,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .to_glib()
@ -780,7 +780,7 @@ where
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -804,7 +804,7 @@ where
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, { gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -73,7 +73,7 @@ where
let wrap: Borrowed<VideoSink> = from_glib_borrow(ptr); let wrap: Borrowed<VideoSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into() imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .to_glib()

View file

@ -351,7 +351,7 @@ impl HasStreamLock for VideoDecoder {
} }
#[macro_export] #[macro_export]
macro_rules! gst_video_decoder_error( macro_rules! video_decoder_error(
($obj:expr, $weight:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($obj:expr, $weight:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::VideoDecoderExtManual; use $crate::VideoDecoderExtManual;
$obj.error( $obj.error(

View file

@ -5,7 +5,7 @@ use std::mem;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr}; use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
gst::gst_define_mini_object_wrapper!( gst::mini_object_wrapper!(
VideoOverlayRectangle, VideoOverlayRectangle,
VideoOverlayRectangleRef, VideoOverlayRectangleRef,
ffi::GstVideoOverlayRectangle, ffi::GstVideoOverlayRectangle,
@ -170,7 +170,7 @@ impl VideoOverlayRectangleRef {
} }
} }
gst::gst_define_mini_object_wrapper!( gst::mini_object_wrapper!(
VideoOverlayComposition, VideoOverlayComposition,
VideoOverlayCompositionRef, VideoOverlayCompositionRef,
ffi::GstVideoOverlayComposition, ffi::GstVideoOverlayComposition,

View file

@ -22,7 +22,7 @@ use glib::translate::{from_glib, from_glib_full, FromGlib, FromGlibPtrFull, ToGl
pub enum Readable {} pub enum Readable {}
pub enum Writable {} pub enum Writable {}
gst_define_mini_object_wrapper!(Buffer, BufferRef, ffi::GstBuffer, || { mini_object_wrapper!(Buffer, BufferRef, ffi::GstBuffer, || {
ffi::gst_buffer_get_type() ffi::gst_buffer_get_type()
}); });

View file

@ -7,7 +7,7 @@ use std::ptr;
use crate::Buffer; use crate::Buffer;
use crate::BufferRef; use crate::BufferRef;
gst_define_mini_object_wrapper!(BufferList, BufferListRef, ffi::GstBufferList, || { mini_object_wrapper!(BufferList, BufferListRef, ffi::GstBufferList, || {
ffi::gst_buffer_list_get_type() ffi::gst_buffer_list_get_type()
}); });

View file

@ -12,7 +12,7 @@ use crate::CapsIntersectMode;
use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, ToGlib, ToGlibPtr}; use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, ToGlib, ToGlibPtr};
use glib::value::ToSendValue; use glib::value::ToSendValue;
gst_define_mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, || { ffi::gst_caps_get_type() }); mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, || { ffi::gst_caps_get_type() });
impl Caps { impl Caps {
pub fn builder(name: &str) -> Builder<NoFeature> { pub fn builder(name: &str) -> Builder<NoFeature> {

View file

@ -7,7 +7,7 @@ use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
use crate::StructureRef; use crate::StructureRef;
gst_define_mini_object_wrapper!(Context, ContextRef, ffi::GstContext, || { mini_object_wrapper!(Context, ContextRef, ffi::GstContext, || {
ffi::gst_context_get_type() ffi::gst_context_get_type()
}); });

View file

@ -914,7 +914,7 @@ pub static ELEMENT_METADATA_LONGNAME: Lazy<&'static str> = Lazy::new(|| unsafe {
}); });
#[macro_export] #[macro_export]
macro_rules! gst_element_error( macro_rules! element_error(
($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::ElementExtManual; use $crate::ElementExtManual;
$obj.message_full( $obj.message_full(
@ -1069,7 +1069,7 @@ macro_rules! gst_element_error(
); );
#[macro_export] #[macro_export]
macro_rules! gst_element_warning( macro_rules! element_warning(
($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::ElementExtManual; use $crate::ElementExtManual;
$obj.message_full( $obj.message_full(
@ -1224,7 +1224,7 @@ macro_rules! gst_element_warning(
); );
#[macro_export] #[macro_export]
macro_rules! gst_element_info( macro_rules! element_info(
($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($obj:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::ElementExtManual; use $crate::ElementExtManual;
$obj.message_full( $obj.message_full(

View file

@ -5,7 +5,7 @@ use thiserror::Error;
use glib::IsA; use glib::IsA;
#[macro_export] #[macro_export]
macro_rules! gst_error_msg( macro_rules! error_msg(
// Plain strings // Plain strings
($err:expr, ($msg:expr), [$dbg:expr]) => { ($err:expr, ($msg:expr), [$dbg:expr]) => {
$crate::ErrorMessage::new(&$err, Some($msg), $crate::ErrorMessage::new(&$err, Some($msg),
@ -80,7 +80,7 @@ impl ErrorMessage {
} }
#[macro_export] #[macro_export]
macro_rules! gst_loggable_error( macro_rules! loggable_error(
// Plain strings // Plain strings
($cat:expr, $msg:expr) => { ($cat:expr, $msg:expr) => {
$crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($msg)) $crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($msg))
@ -93,7 +93,7 @@ macro_rules! gst_loggable_error(
); );
#[macro_export] #[macro_export]
macro_rules! gst_result_from_gboolean( macro_rules! result_from_gboolean(
// Plain strings // Plain strings
($ffi_bool:expr, $cat:expr, $msg:expr) => { ($ffi_bool:expr, $cat:expr, $msg:expr) => {
$crate::glib::result_from_gboolean!($ffi_bool, $msg) $crate::glib::result_from_gboolean!($ffi_bool, $msg)

View file

@ -129,7 +129,7 @@ impl PartialOrd for EventType {
} }
} }
gst_define_mini_object_wrapper!(Event, EventRef, ffi::GstEvent, || { mini_object_wrapper!(Event, EventRef, ffi::GstEvent, || {
ffi::gst_event_get_type() ffi::gst_event_get_type()
}); });

View file

@ -13,7 +13,7 @@ use crate::AllocationParams;
use crate::Allocator; use crate::Allocator;
use crate::MemoryFlags; use crate::MemoryFlags;
gst_define_mini_object_wrapper!(Memory, MemoryRef, ffi::GstMemory, || { mini_object_wrapper!(Memory, MemoryRef, ffi::GstMemory, || {
ffi::gst_memory_get_type() ffi::gst_memory_get_type()
}); });

View file

@ -21,7 +21,7 @@ use glib::value::ToSendValue;
use glib::Cast; use glib::Cast;
use glib::IsA; use glib::IsA;
gst_define_mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || { mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || {
ffi::gst_message_get_type() ffi::gst_message_get_type()
}); });

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#[macro_export] #[macro_export]
macro_rules! gst_define_mini_object_wrapper( macro_rules! mini_object_wrapper(
($name:ident, $ref_name:ident, $ffi_name:path, $get_type:expr) => { ($name:ident, $ref_name:ident, $ffi_name:path, $get_type:expr) => {
pub struct $name { pub struct $name {
obj: std::ptr::NonNull<$ref_name>, obj: std::ptr::NonNull<$ref_name>,

View file

@ -11,7 +11,7 @@ use std::ptr;
use glib::translate::*; use glib::translate::*;
gst_define_mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, || { mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, || {
ffi::gst_query_get_type() ffi::gst_query_get_type()
}); });

View file

@ -17,7 +17,7 @@ use crate::Segment;
use crate::Structure; use crate::Structure;
use crate::StructureRef; use crate::StructureRef;
gst_define_mini_object_wrapper!(Sample, SampleRef, ffi::GstSample, || { mini_object_wrapper!(Sample, SampleRef, ffi::GstSample, || {
ffi::gst_sample_get_type() ffi::gst_sample_get_type()
}); });

View file

@ -43,12 +43,12 @@ impl<T: BinImpl> BinImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass;
let f = (*parent_class).add_element.ok_or_else(|| { let f = (*parent_class).add_element.ok_or_else(|| {
gst_loggable_error!( loggable_error!(
crate::CAT_RUST, crate::CAT_RUST,
"Parent function `add_element` is not defined" "Parent function `add_element` is not defined"
) )
})?; })?;
gst_result_from_gboolean!( result_from_gboolean!(
f( f(
bin.unsafe_cast_ref::<crate::Bin>().to_glib_none().0, bin.unsafe_cast_ref::<crate::Bin>().to_glib_none().0,
element.to_glib_none().0 element.to_glib_none().0
@ -68,12 +68,12 @@ impl<T: BinImpl> BinImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass;
let f = (*parent_class).remove_element.ok_or_else(|| { let f = (*parent_class).remove_element.ok_or_else(|| {
gst_loggable_error!( loggable_error!(
crate::CAT_RUST, crate::CAT_RUST,
"Parent function `remove_element` is not defined" "Parent function `remove_element` is not defined"
) )
})?; })?;
gst_result_from_gboolean!( result_from_gboolean!(
f( f(
bin.unsafe_cast_ref::<crate::Bin>().to_glib_none().0, bin.unsafe_cast_ref::<crate::Bin>().to_glib_none().0,
element.to_glib_none().0 element.to_glib_none().0
@ -122,7 +122,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Bin> = from_glib_borrow(ptr); let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, { panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -154,7 +154,7 @@ where
return glib::ffi::GFALSE; return glib::ffi::GFALSE;
} }
gst_panic_to_error!(&wrap, &instance.panicked(), false, { panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -176,7 +176,7 @@ unsafe extern "C" fn bin_handle_message<T: BinImpl>(
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Bin> = from_glib_borrow(ptr); let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), (), { panic_to_error!(&wrap, &instance.panicked(), (), {
imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message)) imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message))
}); });
} }

View file

@ -59,13 +59,13 @@ impl<T: DeviceImpl> DeviceImplExt for T {
// Don't steal floating reference here but pass it further to the caller // Don't steal floating reference here but pass it further to the caller
Option::<_>::from_glib_full(ptr).ok_or_else(|| { Option::<_>::from_glib_full(ptr).ok_or_else(|| {
gst_loggable_error!( loggable_error!(
crate::CAT_RUST, crate::CAT_RUST,
"Failed to create element using the parent function" "Failed to create element using the parent function"
) )
}) })
} else { } else {
Err(gst_loggable_error!( Err(loggable_error!(
crate::CAT_RUST, crate::CAT_RUST,
"Parent function `create_element` is not defined" "Parent function `create_element` is not defined"
)) ))
@ -82,12 +82,12 @@ impl<T: DeviceImpl> DeviceImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstDeviceClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstDeviceClass;
let f = (*parent_class).reconfigure_element.ok_or_else(|| { let f = (*parent_class).reconfigure_element.ok_or_else(|| {
gst_loggable_error!( loggable_error!(
crate::CAT_RUST, crate::CAT_RUST,
"Parent function `reconfigure_element` is not defined" "Parent function `reconfigure_element` is not defined"
) )
})?; })?;
gst_result_from_gboolean!( result_from_gboolean!(
f( f(
device.unsafe_cast_ref::<Device>().to_glib_none().0, device.unsafe_cast_ref::<Device>().to_glib_none().0,
element.to_glib_none().0 element.to_glib_none().0

View file

@ -51,9 +51,9 @@ impl<T: DeviceProviderImpl> DeviceProviderImplExt for T {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstDeviceProviderClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstDeviceProviderClass;
let f = (*parent_class).start.ok_or_else(|| { let f = (*parent_class).start.ok_or_else(|| {
gst_loggable_error!(crate::CAT_RUST, "Parent function `start` is not defined") loggable_error!(crate::CAT_RUST, "Parent function `start` is not defined")
})?; })?;
gst_result_from_gboolean!( result_from_gboolean!(
f(device_provider f(device_provider
.unsafe_cast_ref::<DeviceProvider>() .unsafe_cast_ref::<DeviceProvider>()
.to_glib_none() .to_glib_none()

View file

@ -279,7 +279,7 @@ where
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl(); let imp = instance.get_impl();
gst_panic_to_error!(element, &instance.panicked(), fallback(), { f(&imp) }) panic_to_error!(element, &instance.panicked(), fallback(), { f(&imp) })
} }
} }
@ -295,7 +295,7 @@ where
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl(); let imp = instance.get_impl();
gst_panic_to_error!(wrap, &instance.panicked(), fallback(), { panic_to_error!(wrap, &instance.panicked(), fallback(), {
f(&imp, wrap.unsafe_cast_ref()) f(&imp, wrap.unsafe_cast_ref())
}) })
} }
@ -383,7 +383,7 @@ where
_ => StateChangeReturn::Failure, _ => StateChangeReturn::Failure,
}; };
gst_panic_to_error!(&wrap, &instance.panicked(), fallback, { panic_to_error!(&wrap, &instance.panicked(), fallback, {
imp.change_state(wrap.unsafe_cast_ref(), transition).into() imp.change_state(wrap.unsafe_cast_ref(), transition).into()
}) })
.to_glib() .to_glib()
@ -406,7 +406,7 @@ where
// XXX: This is effectively unsafe but the best we can do // XXX: This is effectively unsafe but the best we can do
// See https://bugzilla.gnome.org/show_bug.cgi?id=791193 // See https://bugzilla.gnome.org/show_bug.cgi?id=791193
let pad = gst_panic_to_error!(&wrap, &instance.panicked(), None, { let pad = panic_to_error!(&wrap, &instance.panicked(), None, {
imp.request_new_pad( imp.request_new_pad(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(templ), &from_glib_borrow(templ),
@ -446,7 +446,7 @@ unsafe extern "C" fn element_release_pad<T: ElementImpl>(
return; return;
} }
gst_panic_to_error!(&wrap, &instance.panicked(), (), { panic_to_error!(&wrap, &instance.panicked(), (), {
imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad)) imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad))
}) })
} }
@ -462,7 +462,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, { panic_to_error!(&wrap, &instance.panicked(), false, {
imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .to_glib()
@ -480,7 +480,7 @@ where
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
let query = QueryRef::from_mut_ptr(query); let query = QueryRef::from_mut_ptr(query);
gst_panic_to_error!(&wrap, &instance.panicked(), false, { panic_to_error!(&wrap, &instance.panicked(), false, {
imp.query(wrap.unsafe_cast_ref(), query) imp.query(wrap.unsafe_cast_ref(), query)
}) })
.to_glib() .to_glib()
@ -496,7 +496,7 @@ unsafe extern "C" fn element_set_context<T: ElementImpl>(
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), (), { panic_to_error!(&wrap, &instance.panicked(), (), {
imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context)) imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context))
}) })
} }
@ -514,7 +514,7 @@ where
let clock = Option::<crate::Clock>::from_glib_borrow(clock); let clock = Option::<crate::Clock>::from_glib_borrow(clock);
gst_panic_to_error!(&wrap, &instance.panicked(), false, { panic_to_error!(&wrap, &instance.panicked(), false, {
imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref()) imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref())
}) })
.to_glib() .to_glib()
@ -530,7 +530,7 @@ where
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), None, { panic_to_error!(&wrap, &instance.panicked(), None, {
imp.provide_clock(wrap.unsafe_cast_ref()) imp.provide_clock(wrap.unsafe_cast_ref())
}) })
.to_glib_full() .to_glib_full()

View file

@ -6,7 +6,7 @@ use crate::ErrorMessage;
use crate::FlowReturn; use crate::FlowReturn;
#[macro_export] #[macro_export]
macro_rules! gst_panic_to_error( macro_rules! panic_to_error(
($element:expr, $panicked:expr, $ret:expr, $code:block) => {{ ($element:expr, $panicked:expr, $ret:expr, $code:block) => {{
use std::panic::{self, AssertUnwindSafe}; use std::panic::{self, AssertUnwindSafe};
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
@ -15,7 +15,7 @@ macro_rules! gst_panic_to_error(
#[allow(clippy::unused_unit)] #[allow(clippy::unused_unit)]
{ {
if $panicked.load(Ordering::Relaxed) { if $panicked.load(Ordering::Relaxed) {
$element.post_error_message($crate::gst_error_msg!($crate::LibraryError::Failed, ["Panicked"])); $element.post_error_message($crate::error_msg!($crate::LibraryError::Failed, ["Panicked"]));
$ret $ret
} else { } else {
let result = panic::catch_unwind(AssertUnwindSafe(|| $code)); let result = panic::catch_unwind(AssertUnwindSafe(|| $code));
@ -25,11 +25,11 @@ macro_rules! gst_panic_to_error(
Err(err) => { Err(err) => {
$panicked.store(true, Ordering::Relaxed); $panicked.store(true, Ordering::Relaxed);
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
$element.post_error_message($crate::gst_error_msg!($crate::LibraryError::Failed, ["Panicked: {}", cause])); $element.post_error_message($crate::error_msg!($crate::LibraryError::Failed, ["Panicked: {}", cause]));
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
$element.post_error_message($crate::gst_error_msg!($crate::LibraryError::Failed, ["Panicked: {}", cause])); $element.post_error_message($crate::error_msg!($crate::LibraryError::Failed, ["Panicked: {}", cause]));
} else { } else {
$element.post_error_message($crate::gst_error_msg!($crate::LibraryError::Failed, ["Panicked"])); $element.post_error_message($crate::error_msg!($crate::LibraryError::Failed, ["Panicked"]));
} }
$ret $ret
} }

View file

@ -10,7 +10,7 @@ pub const MINOR_VERSION: i32 = 10;
pub const MINOR_VERSION: i32 = 12; pub const MINOR_VERSION: i32 = 12;
#[macro_export] #[macro_export]
macro_rules! gst_plugin_define( macro_rules! plugin_define(
($name:ident, $description:expr, $plugin_init:ident, ($name:ident, $description:expr, $plugin_init:ident,
$version:expr, $license:expr, $source:expr, $version:expr, $license:expr, $source:expr,
$package:expr, $origin:expr, $release_datetime:expr) => { $package:expr, $origin:expr, $release_datetime:expr) => {

View file

@ -15,7 +15,7 @@ cfg_if::cfg_if! {
} }
#[macro_export] #[macro_export]
macro_rules! gst_plugin_define( macro_rules! plugin_define(
($name:ident, $description:expr, $plugin_init:ident, ($name:ident, $description:expr, $plugin_init:ident,
$version:expr, $license:expr, $source:expr, $version:expr, $license:expr, $source:expr,
$package:expr, $origin:expr, $release_datetime:expr) => { $package:expr, $origin:expr, $release_datetime:expr) => {

View file

@ -335,7 +335,7 @@ impl_tag!(
); );
impl_tag!(PrivateData, Sample, TAG_PRIVATE_DATA, GST_TAG_PRIVATE_DATA); impl_tag!(PrivateData, Sample, TAG_PRIVATE_DATA, GST_TAG_PRIVATE_DATA);
gst_define_mini_object_wrapper!(TagList, TagListRef, ffi::GstTagList, || { mini_object_wrapper!(TagList, TagListRef, ffi::GstTagList, || {
ffi::gst_tag_list_get_type() ffi::gst_tag_list_get_type()
}); });

View file

@ -14,7 +14,7 @@ use crate::TocEntryType;
use crate::TocLoopType; use crate::TocLoopType;
use crate::TocScope; use crate::TocScope;
gst_define_mini_object_wrapper!(Toc, TocRef, ffi::GstToc, || { ffi::gst_toc_get_type() }); mini_object_wrapper!(Toc, TocRef, ffi::GstToc, || { ffi::gst_toc_get_type() });
impl Toc { impl Toc {
pub fn new(scope: TocScope) -> Self { pub fn new(scope: TocScope) -> Self {
@ -81,7 +81,7 @@ impl fmt::Debug for TocRef {
} }
} }
gst_define_mini_object_wrapper!(TocEntry, TocEntryRef, ffi::GstTocEntry, || { mini_object_wrapper!(TocEntry, TocEntryRef, ffi::GstTocEntry, || {
ffi::gst_toc_entry_get_type() ffi::gst_toc_entry_get_type()
}); });