remove gst_ prefix for log macros

It's quite quite common to use similar macros in the form `log::debug!`
or `glib::clone!`. This MR renames the gst log macros so that we can
`gst::debug!` instead of `gst_debug!` and whithout the need for
`use gst::gst_debug`.
This commit is contained in:
François Laignel 2022-02-21 18:56:06 +01:00
parent ad1c2d83a4
commit 972c4e75ac
12 changed files with 77 additions and 85 deletions

View file

@ -5,7 +5,6 @@
// //
// 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;
@ -71,7 +70,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_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

@ -78,7 +78,7 @@ mod mirror {
vertex.compile().unwrap(); vertex.compile().unwrap();
shader.attach_unlocked(&vertex)?; shader.attach_unlocked(&vertex)?;
gst::gst_debug!( gst::debug!(
CAT, CAT,
obj: filter, obj: filter,
"Compiling fragment shader {}", "Compiling fragment shader {}",
@ -97,7 +97,7 @@ mod mirror {
shader.attach_unlocked(&fragment)?; shader.attach_unlocked(&fragment)?;
shader.link().unwrap(); shader.link().unwrap();
gst::gst_debug!( gst::debug!(
CAT, CAT,
obj: filter, obj: filter,
"Successfully compiled and linked {:?}", "Successfully compiled and linked {:?}",

View file

@ -8,7 +8,6 @@
#![allow(clippy::non_send_fields_in_send_ty)] #![allow(clippy::non_send_fields_in_send_ty)]
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};
@ -18,8 +17,6 @@ mod examples_common;
// Our custom FIR filter element is defined in this module // Our custom FIR filter element is defined in this module
mod fir_filter { mod fir_filter {
use super::*;
use gst_base::subclass::prelude::*; use gst_base::subclass::prelude::*;
use byte_slice_cast::*; use byte_slice_cast::*;
@ -149,7 +146,7 @@ mod fir_filter {
// Drop state // Drop state
self.history.lock().unwrap().clear(); self.history.lock().unwrap().clear();
gst_info!(CAT, obj: element, "Stopped"); gst::info!(CAT, obj: element, "Stopped");
Ok(()) Ok(())
} }
@ -163,13 +160,13 @@ mod fir_filter {
// Get coefficients and return directly if we have none // Get coefficients and return directly if we have none
let coeffs = self.coeffs.lock().unwrap(); let coeffs = self.coeffs.lock().unwrap();
if coeffs.is_empty() { if coeffs.is_empty() {
gst_trace!(CAT, obj: element, "No coefficients set -- passthrough"); gst::trace!(CAT, obj: element, "No coefficients set -- passthrough");
return Ok(gst::FlowSuccess::Ok); return Ok(gst::FlowSuccess::Ok);
} }
// 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(|_| {
element_error!( gst::element_error!(
element, element,
gst::CoreError::Failed, gst::CoreError::Failed,
["Failed to map input buffer readable"] ["Failed to map input buffer readable"]
@ -179,7 +176,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| {
element_error!( gst::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]
@ -189,7 +186,7 @@ mod fir_filter {
let mut history = self.history.lock().unwrap(); let mut history = self.history.lock().unwrap();
gst_trace!( gst::trace!(
CAT, CAT,
obj: element, obj: element,
"Transforming {} samples with filter of length {}", "Transforming {} samples with filter of length {}",

View file

@ -4,7 +4,6 @@ use glib::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;
@ -375,7 +374,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_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"
@ -384,7 +383,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_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"
@ -403,7 +402,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_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"
@ -799,7 +798,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
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_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"
@ -808,7 +807,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
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_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"
@ -832,7 +831,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
) { ) {
Ok(_) => gst::FlowReturn::Ok, Ok(_) => gst::FlowReturn::Ok,
Err(_) => { Err(_) => {
gst_error!( gst::error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"Failed to copy buffer metadata" "Failed to copy buffer metadata"

View file

@ -4,7 +4,6 @@ use crate::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;
@ -1379,7 +1378,7 @@ unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
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_warning!( gst::warning!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"buffer {:?} not writable", "buffer {:?} not writable",

View file

@ -4,8 +4,6 @@ use glib::prelude::*;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::{gst_debug, gst_error};
use std::ptr; use std::ptr;
use super::base_src::{BaseSrcImpl, CreateSuccess}; use super::base_src::{BaseSrcImpl, CreateSuccess};
@ -125,7 +123,7 @@ impl<T: PushSrcImpl> PushSrcImplExt 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_debug!( gst::debug!(
gst::CAT_PERFORMANCE, gst::CAT_PERFORMANCE,
obj: element.unsafe_cast_ref::<PushSrc>(), obj: element.unsafe_cast_ref::<PushSrc>(),
"Returned new buffer from parent create function, copying into passed buffer" "Returned new buffer from parent create function, copying into passed buffer"
@ -134,7 +132,7 @@ impl<T: PushSrcImpl> PushSrcImplExt 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_error!( gst::error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: element.unsafe_cast_ref::<PushSrc>(), obj: element.unsafe_cast_ref::<PushSrc>(),
"Failed to map passed buffer writable" "Failed to map passed buffer writable"
@ -153,7 +151,7 @@ impl<T: PushSrcImpl> PushSrcImplExt 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_error!( gst::error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: element.unsafe_cast_ref::<PushSrc>(), obj: element.unsafe_cast_ref::<PushSrc>(),
"Failed to copy buffer metadata" "Failed to copy buffer metadata"
@ -245,7 +243,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
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_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"
@ -254,7 +252,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
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_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"
@ -278,7 +276,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
) { ) {
Ok(_) => gst::FlowReturn::Ok, Ok(_) => gst::FlowReturn::Ok,
Err(_) => { Err(_) => {
gst_error!( gst::error!(
gst::CAT_RUST, gst::CAT_RUST,
obj: &*wrap, obj: &*wrap,
"Failed to copy buffer metadata" "Failed to copy buffer metadata"

View file

@ -111,7 +111,7 @@ impl glib::value::ToValue for ClockTime {
let mut value = glib::Value::for_value_type::<ClockTime>(); let mut value = glib::Value::for_value_type::<ClockTime>();
let gct = self.into_glib(); let gct = self.into_glib();
if gct == ffi::GST_CLOCK_TIME_NONE { if gct == ffi::GST_CLOCK_TIME_NONE {
crate::gst_warning!( crate::warning!(
crate::CAT_RUST, crate::CAT_RUST,
"converting a defined `ClockTime` with value `ffi::GST_CLOCK_TIME_NONE` to `Value`, this is probably not what you wanted.", "converting a defined `ClockTime` with value `ffi::GST_CLOCK_TIME_NONE` to `Value`, this is probably not what you wanted.",
); );

View file

@ -357,87 +357,87 @@ declare_debug_category_from_name!(CAT_LOCKING, "GST_LOCKING");
declare_debug_category_from_name!(CAT_CONTEXT, "GST_CONTEXT"); declare_debug_category_from_name!(CAT_CONTEXT, "GST_CONTEXT");
#[macro_export] #[macro_export]
macro_rules! gst_error( macro_rules! error(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_warning( macro_rules! warning(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_fixme( macro_rules! fixme(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_info( macro_rules! info(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_debug( macro_rules! debug(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_log( macro_rules! log(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_trace( macro_rules! trace(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_memdump( macro_rules! memdump(
($cat:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, obj: $obj, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, obj: $obj, $($args)*)
}}; }};
($cat:expr, $($args:tt)*) => { { ($cat:expr, $($args:tt)*) => { {
$crate::gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, $($args)*) $crate::log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, $($args)*)
}}; }};
); );
#[macro_export] #[macro_export]
macro_rules! gst_log_with_level( macro_rules! log_with_level(
($cat:expr, level: $level:expr, obj: $obj:expr, $($args:tt)*) => { { ($cat:expr, level: $level:expr, obj: $obj:expr, $($args:tt)*) => { {
$crate::DebugCategory::log($cat.clone(), Some($obj), $level, file!(), $crate::DebugCategory::log($cat.clone(), Some($obj), $level, file!(),
module_path!(), line!(), format_args!($($args)*)) module_path!(), line!(), format_args!($($args)*))
@ -645,24 +645,24 @@ mod tests {
Some("some debug category"), Some("some debug category"),
); );
gst_error!(cat, "meh"); error!(cat, "meh");
gst_warning!(cat, "meh"); warning!(cat, "meh");
gst_fixme!(cat, "meh"); fixme!(cat, "meh");
gst_info!(cat, "meh"); info!(cat, "meh");
gst_debug!(cat, "meh"); debug!(cat, "meh");
gst_log!(cat, "meh"); log!(cat, "meh");
gst_trace!(cat, "meh"); trace!(cat, "meh");
gst_memdump!(cat, "meh"); memdump!(cat, "meh");
let obj = crate::Bin::new(Some("meh")); let obj = crate::Bin::new(Some("meh"));
gst_error!(cat, obj: &obj, "meh"); error!(cat, obj: &obj, "meh");
gst_warning!(cat, obj: &obj, "meh"); warning!(cat, obj: &obj, "meh");
gst_fixme!(cat, obj: &obj, "meh"); fixme!(cat, obj: &obj, "meh");
gst_info!(cat, obj: &obj, "meh"); info!(cat, obj: &obj, "meh");
gst_debug!(cat, obj: &obj, "meh"); debug!(cat, obj: &obj, "meh");
gst_log!(cat, obj: &obj, "meh"); log!(cat, obj: &obj, "meh");
gst_trace!(cat, obj: &obj, "meh"); trace!(cat, obj: &obj, "meh");
gst_memdump!(cat, obj: &obj, "meh"); memdump!(cat, obj: &obj, "meh");
} }
#[test] #[test]
@ -703,13 +703,13 @@ mod tests {
debug_remove_default_log_function(); debug_remove_default_log_function();
let log_fn = debug_add_log_function(handler); let log_fn = debug_add_log_function(handler);
gst_info!(cat, obj: &obj, "meh"); info!(cat, obj: &obj, "meh");
receiver.recv().unwrap(); receiver.recv().unwrap();
debug_remove_log_function(log_fn); debug_remove_log_function(log_fn);
gst_info!(cat, obj: &obj, "meh2"); info!(cat, obj: &obj, "meh2");
assert!(receiver.recv().is_err()); assert!(receiver.recv().is_err());
} }
} }

View file

@ -41,7 +41,7 @@ impl MessageRef {
// As a workaround, let's generate an unused valid seqnum. // As a workaround, let's generate an unused valid seqnum.
let next = Seqnum::next(); let next = Seqnum::next();
crate::gst_warning!( crate::warning!(
crate::CAT_RUST, crate::CAT_RUST,
"get_seqnum detected invalid seqnum, returning next {:?}", "get_seqnum detected invalid seqnum, returning next {:?}",
next next

View file

@ -1446,7 +1446,7 @@ where
) { ) {
Ok(PadGetRangeSuccess::NewBuffer(new_buffer)) => { Ok(PadGetRangeSuccess::NewBuffer(new_buffer)) => {
if let Some(passed_buffer) = passed_buffer { if let Some(passed_buffer) = passed_buffer {
gst_debug!( crate::debug!(
crate::CAT_PERFORMANCE, crate::CAT_PERFORMANCE,
obj: pad.unsafe_cast_ref::<glib::Object>(), obj: pad.unsafe_cast_ref::<glib::Object>(),
"Returned new buffer from getrange function, copying into passed buffer" "Returned new buffer from getrange function, copying into passed buffer"
@ -1455,7 +1455,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_error!( crate::error!(
crate::CAT_RUST, crate::CAT_RUST,
obj: pad.unsafe_cast_ref::<glib::Object>(), obj: pad.unsafe_cast_ref::<glib::Object>(),
"Failed to map passed buffer writable" "Failed to map passed buffer writable"
@ -1474,7 +1474,7 @@ where
match new_buffer.copy_into(passed_buffer, crate::BUFFER_COPY_METADATA, 0, None) { match new_buffer.copy_into(passed_buffer, crate::BUFFER_COPY_METADATA, 0, None) {
Ok(_) => FlowReturn::Ok.into_glib(), Ok(_) => FlowReturn::Ok.into_glib(),
Err(_) => { Err(_) => {
gst_error!( crate::error!(
crate::CAT_RUST, crate::CAT_RUST,
obj: pad.unsafe_cast_ref::<glib::Object>(), obj: pad.unsafe_cast_ref::<glib::Object>(),
"Failed to copy buffer metadata" "Failed to copy buffer metadata"

View file

@ -89,18 +89,18 @@ macro_rules! plugin_define(
Ok(_) => $crate::glib::ffi::GTRUE, Ok(_) => $crate::glib::ffi::GTRUE,
Err(err) => { Err(err) => {
let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap(); let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap();
$crate::gst_error!(cat, "Failed to register plugin: {}", err); $crate::error!(cat, "Failed to register plugin: {}", err);
$crate::glib::ffi::GFALSE $crate::glib::ffi::GFALSE
} }
} }
Err(err) => { Err(err) => {
let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap(); let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic: {}", cause); $crate::error!(cat, "Failed to initialize plugin due to panic: {}", cause);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic: {}", cause); $crate::error!(cat, "Failed to initialize plugin due to panic: {}", cause);
} else { } else {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic"); $crate::error!(cat, "Failed to initialize plugin due to panic");
} }
$crate::glib::ffi::GFALSE $crate::glib::ffi::GFALSE

View file

@ -106,18 +106,18 @@ macro_rules! plugin_define(
Ok(_) => $crate::glib::ffi::GTRUE, Ok(_) => $crate::glib::ffi::GTRUE,
Err(err) => { Err(err) => {
let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap(); let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap();
$crate::gst_error!(cat, "Failed to register plugin: {}", err); $crate::error!(cat, "Failed to register plugin: {}", err);
$crate::glib::ffi::GFALSE $crate::glib::ffi::GFALSE
} }
} }
Err(err) => { Err(err) => {
let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap(); let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic: {}", cause); $crate::error!(cat, "Failed to initialize plugin due to panic: {}", cause);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic: {}", cause); $crate::error!(cat, "Failed to initialize plugin due to panic: {}", cause);
} else { } else {
$crate::gst_error!(cat, "Failed to initialize plugin due to panic"); $crate::error!(cat, "Failed to initialize plugin due to panic");
} }
$crate::glib::ffi::GFALSE $crate::glib::ffi::GFALSE