Update for macro renames

This commit is contained in:
Sebastian Dröge 2020-12-20 20:43:45 +02:00
parent ea6c05e16c
commit 3d617371af
69 changed files with 417 additions and 448 deletions

View file

@ -8,7 +8,6 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::gst_loggable_error;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst_base::subclass::prelude::*;
@ -288,14 +287,14 @@ impl BaseTransformImpl for AudioEcho {
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
if incaps != outcaps {
return Err(gst_loggable_error!(
return Err(gst::loggable_error!(
CAT,
"Input and output caps are not the same"
));
}
let info = gst_audio::AudioInfo::from_caps(incaps)
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse input caps"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let max_delay = self.settings.lock().unwrap().max_delay;
let size = max_delay * (info.rate() as u64) / gst::SECOND_VAL;
let buffer_size = size * (info.channels() as u64);

View file

@ -12,7 +12,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_loggable_error};
use gst::{gst_debug, gst_error};
use gst_base::subclass::base_transform::BaseTransformImplExt;
use gst_base::subclass::base_transform::GenerateOutputSuccess;
use gst_base::subclass::prelude::*;
@ -260,11 +260,11 @@ impl BaseTransformImpl for AudioRNNoise {
// Flush previous state
if self.state.lock().unwrap().is_some() {
self.drain(element).map_err(|e| {
gst_loggable_error!(CAT, "Error flusing previous state data {:?}", e)
gst::loggable_error!(CAT, "Error flusing previous state data {:?}", e)
})?;
}
if incaps != outcaps {
return Err(gst_loggable_error!(
return Err(gst::loggable_error!(
CAT,
"Input and output caps are not the same"
));
@ -273,7 +273,7 @@ impl BaseTransformImpl for AudioRNNoise {
gst_debug!(CAT, obj: element, "Set caps to {}", incaps);
let in_info = gst_audio::AudioInfo::from_caps(incaps)
.map_err(|e| gst_loggable_error!(CAT, "Failed to parse input caps {:?}", e))?;
.map_err(|e| gst::loggable_error!(CAT, "Failed to parse input caps {:?}", e))?;
let mut denoisers = vec![];
for _i in 0..in_info.channels() {
@ -308,7 +308,7 @@ impl BaseTransformImpl for AudioRNNoise {
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Negotiation,
["Can not generate an output without State"]

View file

@ -17,7 +17,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
rsaudiofx,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,8 +9,7 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error};
use gst_audio::gst_audio_decoder_error;
use gst::{gst_debug, gst_error};
use gst_audio::prelude::*;
use gst_audio::subclass::prelude::*;
@ -221,12 +220,12 @@ impl ClaxonDec {
indata: &[u8],
) -> Result<gst::FlowSuccess, gst::FlowError> {
let streaminfo = get_claxon_streaminfo(indata).map_err(|e| {
gst_element_error!(element, gst::StreamError::Decode, [e]);
gst::element_error!(element, gst::StreamError::Decode, [e]);
gst::FlowError::Error
})?;
let audio_info = get_gstaudioinfo(streaminfo).map_err(|e| {
gst_element_error!(element, gst::StreamError::Decode, [&e]);
gst::element_error!(element, gst::StreamError::Decode, [&e]);
gst::FlowError::Error
})?;
@ -275,7 +274,7 @@ impl ClaxonDec {
Ok(Some(result)) => result,
Ok(None) => return element.finish_frame(None, 1),
Err(err) => {
return gst_audio_decoder_error!(
return gst_audio::audio_decoder_error!(
element,
1,
gst::StreamError::Decode,

View file

@ -12,7 +12,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
claxondec::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
claxon,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -20,8 +20,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_loggable_error,
gst_warning,
element_error, error_msg, gst_debug, gst_error, gst_info, gst_log, gst_warning, loggable_error,
};
use gst_base::subclass::base_transform::GenerateOutputSuccess;
use gst_base::subclass::prelude::*;
@ -194,13 +193,13 @@ impl CsoundFilter {
if let Some(ref location) = settings.location {
csound
.compile_csd(location)
.map_err(|e| gst_error_msg!(gst::LibraryError::Failed, [e]))?;
.map_err(|e| error_msg!(gst::LibraryError::Failed, [e]))?;
} else if let Some(ref text) = settings.csd_text {
csound
.compile_csd_text(text)
.map_err(|e| gst_error_msg!(gst::LibraryError::Failed, [e]))?;
.map_err(|e| error_msg!(gst::LibraryError::Failed, [e]))?;
} else {
return Err(gst_error_msg!(
return Err(error_msg!(
gst::LibraryError::Failed,
["No Csound score specified to compile. Use either location or csd-text but not both"]
));
@ -500,7 +499,7 @@ impl BaseTransformImpl for CsoundFilter {
csound.set_score_offset_seconds(settings.offset);
if let Err(e) = csound.start() {
return Err(gst_error_msg!(gst::LibraryError::Failed, [e]));
return Err(error_msg!(gst::LibraryError::Failed, [e]));
}
Ok(())
@ -589,15 +588,14 @@ impl BaseTransformImpl for CsoundFilter {
) -> Result<(), gst::LoggableError> {
// Flush previous state
if self.state.lock().unwrap().is_some() {
self.drain(element).map_err(|e| {
gst_loggable_error!(CAT, "Error flusing previous state data {:?}", e)
})?;
self.drain(element)
.map_err(|e| loggable_error!(CAT, "Error flusing previous state data {:?}", e))?;
}
let in_info = gst_audio::AudioInfo::from_caps(incaps)
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse input caps"))?;
.map_err(|_| loggable_error!(CAT, "Failed to parse input caps"))?;
let out_info = gst_audio::AudioInfo::from_caps(outcaps)
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse output caps"))?;
.map_err(|_| loggable_error!(CAT, "Failed to parse output caps"))?;
let csound = self.csound.lock().unwrap();
@ -607,19 +605,19 @@ impl BaseTransformImpl for CsoundFilter {
// Check if the negotiated caps are the right ones
if rate != out_info.rate() || rate != csound.get_sample_rate() as _ {
return Err(gst_loggable_error!(
return Err(loggable_error!(
CAT,
"Failed to negotiate caps: invalid sample rate {}",
rate
));
} else if ichannels != csound.input_channels() {
return Err(gst_loggable_error!(
return Err(loggable_error!(
CAT,
"Failed to negotiate caps: input channels {} not supported",
ichannels
));
} else if ochannels != csound.output_channels() {
return Err(gst_loggable_error!(
return Err(loggable_error!(
CAT,
"Failed to negotiate caps: output channels {} not supported",
ochannels
@ -655,7 +653,7 @@ impl BaseTransformImpl for CsoundFilter {
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().ok_or_else(|| {
gst_element_error!(
element_error!(
element,
gst::CoreError::Negotiation,
["Can not generate an output without State"]

View file

@ -15,8 +15,6 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
use gst::gst_plugin_define;
mod filter;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
@ -24,7 +22,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::plugin_define!(
csound,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,8 +9,8 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_warning};
use gst_audio::gst_audio_decoder_error;
use gst::{gst_debug, gst_error, gst_warning};
use gst_audio::audio_decoder_error;
use gst_audio::prelude::*;
use gst_audio::subclass::prelude::*;
@ -262,7 +262,7 @@ impl LewtonDec {
(ident_buf, comment_buf, setup_buf)
}
_ => {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Got no headers before data packets"]
@ -277,7 +277,7 @@ impl LewtonDec {
gst::FlowError::Error
})?;
let ident = lewton::header::read_header_ident(ident_map.as_ref()).map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Failed to parse ident header: {:?}", err]
@ -290,7 +290,7 @@ impl LewtonDec {
gst::FlowError::Error
})?;
let comment = lewton::header::read_header_comment(comment_map.as_ref()).map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Failed to parse comment header: {:?}", err]
@ -308,7 +308,7 @@ impl LewtonDec {
(ident.blocksize_0, ident.blocksize_1),
)
.map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Failed to parse setup header: {:?}", err]
@ -384,7 +384,7 @@ impl LewtonDec {
{
Ok(decoded) => decoded,
Err(err) => {
return gst_audio_decoder_error!(
return audio_decoder_error!(
element,
1,
gst::StreamError::Decode,
@ -394,7 +394,7 @@ impl LewtonDec {
};
if decoded.channel_count != audio_info.channels() as usize {
return gst_audio_decoder_error!(
return audio_decoder_error!(
element,
1,
gst::StreamError::Decode,
@ -417,7 +417,7 @@ impl LewtonDec {
let mut outbuf = element
.allocate_output_buffer(sample_count as usize * audio_info.bpf() as usize)
.map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Failed to allocate output buffer"]
@ -429,7 +429,7 @@ impl LewtonDec {
// GStreamer channel order
let outbuf = outbuf.get_mut().unwrap();
let mut outmap = outbuf.map_writable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Decode,
["Failed to map output buffer writable"]

View file

@ -12,7 +12,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
lewtondec::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
lewton,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -12,7 +12,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_trace};
use gst::{gst_debug, gst_error, gst_info, gst_trace};
use gst_base::subclass::prelude::*;
use std::fs::File;
@ -206,14 +206,14 @@ impl BaseSinkImpl for FileSink {
let settings = self.settings.lock().unwrap();
let location = settings.location.as_ref().ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Settings,
["File location is not defined"]
)
})?;
let file = File::create(location).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenWrite,
[
"Could not open file {} for writing: {}",
@ -233,7 +233,7 @@ impl BaseSinkImpl for FileSink {
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
let mut state = self.state.lock().unwrap();
if let State::Stopped = *state {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["FileSink not started"]
));
@ -259,19 +259,19 @@ impl BaseSinkImpl for FileSink {
ref mut position,
} => (file, position),
State::Stopped => {
gst_element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
gst::element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
return Err(gst::FlowError::Error);
}
};
gst_trace!(CAT, obj: element, "Rendering {:?}", buffer);
let map = buffer.map_readable().map_err(|_| {
gst_element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
gst::element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
gst::FlowError::Error
})?;
file.write_all(map.as_ref()).map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::ResourceError::Write,
["Failed to write buffer: {}", err]

View file

@ -11,7 +11,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info};
use gst::{gst_debug, gst_error, gst_info};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
@ -239,14 +239,14 @@ impl BaseSrcImpl for FileSrc {
let settings = self.settings.lock().unwrap();
let location = settings.location.as_ref().ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Settings,
["File location is not defined"]
)
})?;
let file = File::open(location).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
[
"Could not open file {} for reading: {}",
@ -268,7 +268,7 @@ impl BaseSrcImpl for FileSrc {
fn stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
let mut state = self.state.lock().unwrap();
if let State::Stopped = *state {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["FileSrc not started"]
));
@ -296,14 +296,14 @@ impl BaseSrcImpl for FileSrc {
ref mut position,
} => (file, position),
State::Stopped => {
gst_element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
gst::element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
return Err(gst::FlowError::Error);
}
};
if *position != offset {
file.seek(SeekFrom::Start(offset)).map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
["Failed to seek to {}: {}", offset, err.to_string()]
@ -316,12 +316,12 @@ impl BaseSrcImpl for FileSrc {
let size = {
let mut map = buffer.map_writable().map_err(|_| {
gst_element_error!(element, gst::LibraryError::Failed, ["Failed to map buffer"]);
gst::element_error!(element, gst::LibraryError::Failed, ["Failed to map buffer"]);
gst::FlowError::Error
})?;
file.read(map.as_mut()).map_err(|err| {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
["Failed to read at {}: {}", offset, err.to_string()]

View file

@ -16,7 +16,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
rsfile,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -27,7 +27,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_loggable_error};
use gst::{gst_debug, gst_error, gst_log};
use sodiumoxide::crypto::box_;
use std::sync::Mutex;
@ -83,7 +83,7 @@ impl State {
.as_ref()
.and_then(|k| box_::PublicKey::from_slice(&k))
.ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::NotFound,
[format!(
"Failed to set Sender's Key from property: {:?}",
@ -98,7 +98,7 @@ impl State {
.as_ref()
.and_then(|k| box_::SecretKey::from_slice(&k))
.ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::NotFound,
[format!(
"Failed to set Receiver's Key from property: {:?}",
@ -129,7 +129,7 @@ impl State {
chunk_index: u64,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let map = buffer.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Failed to map buffer readable"]
@ -146,7 +146,7 @@ impl State {
for subbuffer in map.chunks(block_size) {
let plain = box_::open_precomputed(&subbuffer, &nonce, &self.precomputed_key).map_err(
|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Failed to decrypt buffer"]
@ -289,8 +289,8 @@ impl Decrypter {
// right after we activate the pad
self.check_headers(element)
}
gst::PadMode::Push => Err(gst_loggable_error!(CAT, "Push mode not supported")),
_ => Err(gst_loggable_error!(
gst::PadMode::Push => Err(gst::loggable_error!(CAT, "Push mode not supported")),
_ => Err(gst::loggable_error!(
CAT,
"Failed to activate the pad in Unknown mode, {:?}",
mode
@ -389,7 +389,7 @@ impl Decrypter {
.sinkpad
.pull_range(0, crate::HEADERS_SIZE as u32)
.map_err(|err| {
let err = gst_loggable_error!(
let err = gst::loggable_error!(
CAT,
"Failed to pull nonce from the stream, reason: {:?}",
err
@ -399,20 +399,20 @@ impl Decrypter {
})?;
if buffer.get_size() != crate::HEADERS_SIZE {
let err = gst_loggable_error!(CAT, "Headers buffer has wrong size");
let err = gst::loggable_error!(CAT, "Headers buffer has wrong size");
err.log_with_object(element);
return Err(err);
}
let map = buffer.map_readable().map_err(|_| {
let err = gst_loggable_error!(CAT, "Failed to map buffer readable");
let err = gst::loggable_error!(CAT, "Failed to map buffer readable");
err.log_with_object(element);
err
})?;
let sodium_header_slice = &map[..crate::TYPEFIND_HEADER_SIZE];
if sodium_header_slice != crate::TYPEFIND_HEADER {
let err = gst_loggable_error!(CAT, "Buffer has wrong typefind header");
let err = gst::loggable_error!(CAT, "Buffer has wrong typefind header");
err.log_with_object(element);
return Err(err);
}
@ -421,7 +421,7 @@ impl Decrypter {
&map[crate::TYPEFIND_HEADER_SIZE..crate::TYPEFIND_HEADER_SIZE + box_::NONCEBYTES];
assert_eq!(nonce_slice.len(), box_::NONCEBYTES);
let nonce = box_::Nonce::from_slice(nonce_slice).ok_or_else(|| {
let err = gst_loggable_error!(CAT, "Failed to create nonce from buffer");
let err = gst::loggable_error!(CAT, "Failed to create nonce from buffer");
err.log_with_object(&self.srcpad);
err
})?;
@ -463,7 +463,7 @@ impl Decrypter {
// calculate how many chunks are needed, if we need something like 3.2
// round the number to 4 and cut the buffer afterwards.
let checked = requested_size.checked_add(block_size).ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
[
@ -481,7 +481,7 @@ impl Decrypter {
// Pull a buffer of all the chunks we will need
let checked_size = total_chunks.checked_mul(block_size).ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
[
@ -587,7 +587,7 @@ impl ObjectSubclass for Decrypter {
Decrypter::catch_panic_pad_function(
parent,
|| {
Err(gst_loggable_error!(
Err(gst::loggable_error!(
CAT,
"Panic activating srcpad with mode"
))

View file

@ -27,7 +27,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log};
use gst::{gst_debug, gst_error, gst_log};
use smallvec::SmallVec;
use sodiumoxide::crypto::box_;
@ -109,7 +109,7 @@ impl State {
.as_ref()
.and_then(|k| box_::SecretKey::from_slice(&k))
.ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::NotFound,
[format!(
"Failed to set Sender's Key from property: {:?}",
@ -124,7 +124,7 @@ impl State {
.as_ref()
.and_then(|k| box_::PublicKey::from_slice(&k))
.ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::NotFound,
[format!(
"Failed to set Receiver's Key from property: {:?}",
@ -230,7 +230,7 @@ impl Encrypter {
.encrypt_blocks(state.block_size as usize)
.map_err(|err| {
// log the error to the bus
gst_element_error!(
gst::element_error!(
element,
gst::ResourceError::Write,
["Failed to decrypt buffer"]
@ -279,7 +279,7 @@ impl Encrypter {
if avail > 0 {
match state.encrypt_blocks(avail) {
Err(_) => {
gst_element_error!(
gst::element_error!(
element,
gst::ResourceError::Write,
["Failed to encrypt buffers at EOS"]

View file

@ -61,7 +61,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
sodium,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -27,7 +27,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use once_cell::sync::Lazy;
@ -351,7 +351,7 @@ impl TaskImpl for AppSrcTask {
Some(item) => item,
None => {
gst_error!(CAT, obj: &self.element, "SrcPad channel aborted");
gst_element_error!(
gst::element_error!(
&self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -379,7 +379,7 @@ impl TaskImpl for AppSrcTask {
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
gst_element_error!(
gst::element_error!(
&self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -490,14 +490,14 @@ impl AppSrc {
let context =
Context::acquire(&settings.context, settings.context_wait).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
})?;
let max_buffers = settings.max_buffers.try_into().map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Settings,
["Invalid max-buffers: {}, {}", settings.max_buffers, err]
)
@ -514,7 +514,7 @@ impl AppSrc {
context,
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -25,7 +25,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_info, gst_log, gst_trace};
use gst_rtp::RTPBuffer;
use once_cell::sync::Lazy;
@ -664,7 +664,7 @@ impl PadSinkHandler for SinkHandler {
if let EventView::FlushStart(..) = event.view() {
if let Err(err) = jb.task.flush_start() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -710,7 +710,7 @@ impl PadSinkHandler for SinkHandler {
EventView::FlushStop(..) => {
if let Err(err) = jb.task.flush_stop() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -993,7 +993,7 @@ impl PadSrcHandler for SrcHandler {
EventView::FlushStart(..) => {
if let Err(err) = jb.task.flush_start() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -1005,7 +1005,7 @@ impl PadSrcHandler for SrcHandler {
EventView::FlushStop(..) => {
if let Err(err) = jb.task.flush_stop() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -1377,7 +1377,7 @@ impl JitterBuffer {
context,
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -42,8 +42,6 @@ mod queue;
use glib::translate::*;
use gst::gst_plugin_define;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
udpsrc::register(plugin)?;
udpsink::register(plugin)?;
@ -57,7 +55,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::plugin_define!(
threadshare,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -25,7 +25,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use once_cell::sync::Lazy;
@ -592,7 +592,7 @@ impl ProxySink {
let proxy_context = self.settings.lock().unwrap().proxy_context.to_string();
let proxy_ctx = ProxyContext::get(&proxy_context, true).ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to create or get ProxyContext"]
)
@ -823,7 +823,7 @@ impl PadSrcHandler for ProxySrcPadHandler {
EventView::FlushStart(..) => {
if let Err(err) = proxysrc.task.flush_start() {
gst_error!(SRC_CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -835,7 +835,7 @@ impl PadSrcHandler for ProxySrcPadHandler {
EventView::FlushStop(..) => {
if let Err(err) = proxysrc.task.flush_stop() {
gst_error!(SRC_CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -980,7 +980,7 @@ impl TaskImpl for ProxySrcTask {
}
Err(err) => {
gst_error!(SRC_CAT, obj: &self.element, "Got error {}", err);
gst_element_error!(
gst::element_error!(
&self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -1063,14 +1063,14 @@ impl ProxySrc {
let settings = self.settings.lock().unwrap().clone();
let proxy_ctx = ProxyContext::get(&settings.proxy_context, false).ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to create get shared_state"]
)
})?;
let ts_ctx = Context::acquire(&settings.context, settings.context_wait).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
@ -1112,7 +1112,7 @@ impl ProxySrc {
self.task
.prepare(ProxySrcTask::new(element, &self.src_pad, dataqueue), ts_ctx)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -25,7 +25,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use once_cell::sync::Lazy;
@ -194,7 +194,7 @@ impl PadSinkHandler for QueuePadSinkHandler {
if let EventView::FlushStart(..) = event.view() {
if let Err(err) = queue.task.flush_start() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -228,7 +228,7 @@ impl PadSinkHandler for QueuePadSinkHandler {
if let EventView::FlushStop(..) = event.view() {
if let Err(err) = queue.task.flush_stop() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -321,7 +321,7 @@ impl PadSrcHandler for QueuePadSrcHandler {
EventView::FlushStop(..) => {
if let Err(err) = queue.task.flush_stop() {
gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -442,7 +442,7 @@ impl TaskImpl for QueueTask {
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
gst_element_error!(
gst::element_error!(
&self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -700,7 +700,7 @@ impl Queue {
let context =
Context::acquire(&settings.context, settings.context_wait).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
@ -709,7 +709,7 @@ impl Queue {
self.task
.prepare(QueueTask::new(element, &self.src_pad, dataqueue), context)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -72,7 +72,7 @@ use futures::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_fixme, gst_log, gst_loggable_error};
use gst::{gst_debug, gst_error, gst_fixme, gst_log};
use gst::{FlowError, FlowSuccess};
use std::marker::PhantomData;
@ -145,7 +145,7 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static {
"Error in PadSrc activate: {:?}",
err
);
gst_loggable_error!(RUNTIME_CAT, "Error in PadSrc activate: {:?}", err)
gst::loggable_error!(RUNTIME_CAT, "Error in PadSrc activate: {:?}", err)
})
}
@ -335,7 +335,7 @@ impl<'a> PadSrcRef<'a> {
if mode == gst::PadMode::Pull {
gst_error!(RUNTIME_CAT, obj: self.gst_pad(), "Pull mode not supported by PadSrc");
return Err(gst_loggable_error!(
return Err(gst::loggable_error!(
RUNTIME_CAT,
"Pull mode not supported by PadSrc"
));
@ -398,7 +398,10 @@ impl PadSrc {
parent,
|| {
gst_error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSrc activate");
Err(gst_loggable_error!(RUNTIME_CAT, "Panic in PadSrc activate"))
Err(gst::loggable_error!(
RUNTIME_CAT,
"Panic in PadSrc activate"
))
},
move |imp, element| {
let this_ref = PadSrcRef::new(inner_arc);
@ -421,7 +424,7 @@ impl PadSrc {
parent,
|| {
gst_error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSrc activatemode");
Err(gst_loggable_error!(
Err(gst::loggable_error!(
RUNTIME_CAT,
"Panic in PadSrc activatemode"
))
@ -492,11 +495,11 @@ impl Drop for PadSrc {
unsafe {
self.gst_pad()
.set_activate_function(move |_gst_pad, _parent| {
Err(gst_loggable_error!(RUNTIME_CAT, "PadSrc no longer exists"))
Err(gst::loggable_error!(RUNTIME_CAT, "PadSrc no longer exists"))
});
self.gst_pad()
.set_activatemode_function(move |_gst_pad, _parent, _mode, _active| {
Err(gst_loggable_error!(RUNTIME_CAT, "PadSrc no longer exists"))
Err(gst::loggable_error!(RUNTIME_CAT, "PadSrc no longer exists"))
});
self.gst_pad()
.set_event_function(move |_gst_pad, _parent, _event| false);
@ -553,7 +556,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static {
"Error in PadSink activate: {:?}",
err
);
gst_loggable_error!(RUNTIME_CAT, "Error in PadSink activate: {:?}", err)
gst::loggable_error!(RUNTIME_CAT, "Error in PadSink activate: {:?}", err)
})
}
@ -746,7 +749,7 @@ impl<'a> PadSinkRef<'a> {
if mode == gst::PadMode::Pull {
gst_error!(RUNTIME_CAT, obj: self.gst_pad(), "Pull mode not supported by PadSink");
return Err(gst_loggable_error!(
return Err(gst::loggable_error!(
RUNTIME_CAT,
"Pull mode not supported by PadSink"
));
@ -816,7 +819,7 @@ impl PadSink {
parent,
|| {
gst_error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSink activate");
Err(gst_loggable_error!(
Err(gst::loggable_error!(
RUNTIME_CAT,
"Panic in PadSink activate"
))
@ -842,7 +845,7 @@ impl PadSink {
parent,
|| {
gst_error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSink activatemode");
Err(gst_loggable_error!(
Err(gst::loggable_error!(
RUNTIME_CAT,
"Panic in PadSink activatemode"
))
@ -1031,11 +1034,17 @@ impl Drop for PadSink {
unsafe {
self.gst_pad()
.set_activate_function(move |_gst_pad, _parent| {
Err(gst_loggable_error!(RUNTIME_CAT, "PadSink no longer exists"))
Err(gst::loggable_error!(
RUNTIME_CAT,
"PadSink no longer exists"
))
});
self.gst_pad()
.set_activatemode_function(move |_gst_pad, _parent, _mode, _active| {
Err(gst_loggable_error!(RUNTIME_CAT, "PadSink no longer exists"))
Err(gst::loggable_error!(
RUNTIME_CAT,
"PadSink no longer exists"
))
});
self.gst_pad()
.set_chain_function(move |_gst_pad, _parent, _buffer| Err(FlowError::Flushing));

View file

@ -24,7 +24,7 @@ use futures::future::{self, abortable, AbortHandle, Aborted, BoxFuture, RemoteHa
use futures::prelude::*;
use futures::stream::StreamExt;
use gst::{gst_debug, gst_error, gst_error_msg, gst_fixme, gst_log, gst_trace, gst_warning};
use gst::{gst_debug, gst_error, gst_fixme, gst_log, gst_trace, gst_warning};
use std::fmt;
use std::ops::Deref;
@ -244,7 +244,7 @@ impl TriggeringEvent {
let res = Err(TransitionError {
trigger: self.trigger,
state: TaskState::Error,
err_msg: gst_error_msg!(
err_msg: gst::error_msg!(
gst::CoreError::StateChange,
[
"Triggering Event {:?} rejected due to a previous unrecoverable error",
@ -305,7 +305,7 @@ impl TaskInner {
let res = Err(TransitionError {
trigger: triggering_evt.trigger,
state: self.state,
err_msg: gst_error_msg!(
err_msg: gst::error_msg!(
gst::CoreError::StateChange,
[
"Unrecoverable error for {:?} from state {:?}",
@ -349,7 +349,7 @@ impl TaskInner {
TransitionError {
trigger,
state: self.state,
err_msg: gst_error_msg!(resource_err, ["Unable to send {:?}: {:?}", trigger, err]),
err_msg: gst::error_msg!(resource_err, ["Unable to send {:?}: {:?}", trigger, err]),
}
})?;
@ -426,7 +426,7 @@ impl Task {
return Err(TransitionError {
trigger: Trigger::Prepare,
state: inner.state,
err_msg: gst_error_msg!(
err_msg: gst::error_msg!(
gst::CoreError::StateChange,
["Attempt to prepare Task in state {:?}", state]
),
@ -479,7 +479,7 @@ impl Task {
return Err(TransitionError {
trigger: Trigger::Unprepare,
state: inner.state,
err_msg: gst_error_msg!(
err_msg: gst::error_msg!(
gst::CoreError::StateChange,
["Attempt to unprepare Task in state {:?}", state]
),
@ -704,7 +704,7 @@ macro_rules! exec_action {
res = Context::drain_sub_tasks().await.map_err(|err| {
let msg = format!("{} subtask returned {:?}", stringify!($action), err);
gst_log!(RUNTIME_CAT, "{}", &msg);
gst_error_msg!(gst::CoreError::StateChange, ["{}", &msg])
gst::error_msg!(gst::CoreError::StateChange, ["{}", &msg])
});
if res.is_err() {
@ -1036,7 +1036,7 @@ impl StateMachine {
res = Context::drain_sub_tasks().await.map_err(|err| {
let msg = format!("start subtask returned {:?}", err);
gst_log!(RUNTIME_CAT, "{}", &msg);
gst_error_msg!(gst::CoreError::StateChange, ["{}", &msg])
gst::error_msg!(gst::CoreError::StateChange, ["{}", &msg])
});
if res.is_err() {
@ -1483,7 +1483,7 @@ mod tests {
fn prepare(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> {
async move {
gst_debug!(RUNTIME_CAT, "prepare_error: prepare returning an error");
Err(gst_error_msg!(
Err(gst::error_msg!(
gst::ResourceError::Failed,
["prepare_error: intentional error"]
))
@ -1680,7 +1680,7 @@ mod tests {
self.prepare_receiver.next().await.unwrap();
gst_debug!(RUNTIME_CAT, "prepare_start_error: preparation complete Err");
Err(gst_error_msg!(
Err(gst::error_msg!(
gst::ResourceError::Failed,
["prepare_start_error: intentional error"]
))

View file

@ -19,7 +19,7 @@
use futures::future::BoxFuture;
use gst::prelude::*;
use gst::{gst_debug, gst_error, gst_error_msg, gst_log};
use gst::{gst_debug, gst_error, gst_log};
use once_cell::sync::Lazy;
@ -314,7 +314,7 @@ pub fn wrap_socket(socket: &tokio::net::UdpSocket) -> Result<GioSocketWrapper, g
let fd = FdConverter(fd);
let gio_socket = gio::Socket::from_fd(fd).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenWrite,
["Failed to create wrapped GIO socket: {}", err]
)
@ -339,7 +339,7 @@ pub fn wrap_socket(socket: &tokio::net::UdpSocket) -> Result<GioSocketWrapper, g
let fd = SocketConverter(fd);
let gio_socket = gio::Socket::from_socket(fd).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenWrite,
["Failed to create wrapped GIO socket: {}", err]
)

View file

@ -26,7 +26,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use once_cell::sync::Lazy;
@ -362,7 +362,7 @@ impl TaskImpl for TcpClientSrcTask {
let socket = tokio::net::TcpStream::connect(self.saddr)
.await
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to connect to {:?}: {:?}", self.saddr, err]
)
@ -375,7 +375,7 @@ impl TaskImpl for TcpClientSrcTask {
TcpClientReader::new(socket),
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to prepare socket {:?}", err]
)
@ -418,7 +418,7 @@ impl TaskImpl for TcpClientSrcTask {
gst_error!(CAT, obj: &self.element, "Got error {:?}", err);
match err {
SocketError::Gst(err) => {
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -426,7 +426,7 @@ impl TaskImpl for TcpClientSrcTask {
);
}
SocketError::Io(err) => {
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("I/O error"),
@ -460,7 +460,7 @@ impl TaskImpl for TcpClientSrcTask {
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -518,7 +518,7 @@ impl TcpClientSrc {
let context =
Context::acquire(&settings.context, settings.context_wait).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
@ -526,14 +526,14 @@ impl TcpClientSrc {
let host: IpAddr = match settings.host {
None => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["No host set"]
));
}
Some(ref host) => match host.parse() {
Err(err) => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["Invalid host '{}' set: {}", host, err]
));
@ -547,7 +547,7 @@ impl TcpClientSrc {
let mut config = buffer_pool.get_config();
config.set_params(None, settings.blocksize, 0, 0);
buffer_pool.set_config(config).map_err(|_| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Settings,
["Failed to configure buffer pool"]
)
@ -569,7 +569,7 @@ impl TcpClientSrc {
context,
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -28,8 +28,7 @@ use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::EventView;
use gst::{
gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_trace,
gst_warning,
element_error, error_msg, gst_debug, gst_error, gst_info, gst_log, gst_trace, gst_warning,
};
use once_cell::sync::Lazy;
@ -445,7 +444,7 @@ impl UdpSinkPadHandler {
socket
.join_multicast_v4(addr, Ipv4Addr::new(0, 0, 0, 0))
.map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to join multicast group: {}", err]
)
@ -453,7 +452,7 @@ impl UdpSinkPadHandler {
}
if settings.multicast_loop {
socket.set_multicast_loop_v4(true).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set multicast loop: {}", err]
)
@ -462,7 +461,7 @@ impl UdpSinkPadHandler {
socket
.set_multicast_ttl_v4(settings.ttl_mc)
.map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set multicast ttl: {}", err]
)
@ -473,7 +472,7 @@ impl UdpSinkPadHandler {
if let Some(socket) = socket_v6.as_mut() {
if settings.auto_multicast {
socket.join_multicast_v6(&addr, 0).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to join multicast group: {}", err]
)
@ -481,7 +480,7 @@ impl UdpSinkPadHandler {
}
if settings.multicast_loop {
socket.set_multicast_loop_v6(true).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set multicast loop: {}", err]
)
@ -496,7 +495,7 @@ impl UdpSinkPadHandler {
IpAddr::V4(_) => {
if let Some(socket) = socket.as_mut() {
socket.set_ttl(settings.ttl).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set unicast ttl: {}", err]
)
@ -506,7 +505,7 @@ impl UdpSinkPadHandler {
IpAddr::V6(_) => {
if let Some(socket) = socket_v6.as_mut() {
socket.set_ttl(settings.ttl).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set unicast ttl: {}", err]
)
@ -534,7 +533,7 @@ impl UdpSinkPadHandler {
socket
.leave_multicast_v4(addr, Ipv4Addr::new(0, 0, 0, 0))
.map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to join multicast group: {}", err]
)
@ -546,7 +545,7 @@ impl UdpSinkPadHandler {
if let Some(socket) = socket_v6.as_mut() {
if settings.auto_multicast {
socket.leave_multicast_v6(&addr, 0).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to join multicast group: {}", err]
)
@ -612,7 +611,7 @@ impl UdpSinkPadHandler {
for client in &clients_to_configure {
self.configure_client(&settings, &mut socket, &mut socket_v6, &client)
.map_err(|err| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Failed to configure client {:?}: {}", client, err]
@ -627,7 +626,7 @@ impl UdpSinkPadHandler {
for client in &clients_to_unconfigure {
self.unconfigure_client(&settings, &mut socket, &mut socket_v6, &client)
.map_err(|err| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Failed to unconfigure client {:?}: {}", client, err]
@ -643,7 +642,7 @@ impl UdpSinkPadHandler {
}
let data = buffer.map_readable().map_err(|_| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Format,
["Failed to map buffer readable"]
@ -661,7 +660,7 @@ impl UdpSinkPadHandler {
if let Some(socket) = socket.as_mut() {
gst_log!(CAT, obj: element, "Sending to {:?}", &client);
socket.send_to(&data, client).await.map_err(|err| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
("I/O error"),
@ -670,7 +669,7 @@ impl UdpSinkPadHandler {
gst::FlowError::Error
})?;
} else {
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
("I/O error"),
@ -849,7 +848,7 @@ impl TaskImpl for UdpSinkTask {
Some(TaskItem::Buffer(buffer)) => {
match self.sink_pad_handler.render(&self.element, buffer).await {
Err(err) => {
gst_element_error!(
element_error!(
&self.element,
gst::StreamError::Failed,
["Failed to render item, stopping task: {}", err]
@ -919,7 +918,7 @@ impl UdpSink {
let socket = context.enter(|| {
tokio::net::UdpSocket::from_std(socket).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to setup socket for tokio: {}", err]
)
@ -943,7 +942,7 @@ impl UdpSink {
};
let bind_addr: IpAddr = bind_addr.parse().map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::Settings,
["Invalid address '{}' set: {}", bind_addr, err]
)
@ -988,7 +987,7 @@ impl UdpSink {
};
socket.bind(&saddr.into()).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to bind socket: {}", err]
)
@ -996,7 +995,7 @@ impl UdpSink {
let socket = context.enter(|| {
tokio::net::UdpSocket::from_std(socket.into()).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to setup socket for tokio: {}", err]
)
@ -1007,7 +1006,7 @@ impl UdpSink {
if settings.qos_dscp != -1 {
wrapper.set_tos(settings.qos_dscp).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to set QoS DSCP: {}", err]
)
@ -1038,7 +1037,7 @@ impl UdpSink {
let settings = self.settings.lock().unwrap();
Context::acquire(&settings.context, settings.context_wait).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenWrite,
["Failed to acquire Context: {}", err]
)
@ -1052,7 +1051,7 @@ impl UdpSink {
self.task
.prepare(UdpSinkTask::new(&element, &self.sink_pad_handler), context)
.map_err(|err| {
gst_error_msg!(
error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -25,7 +25,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_log, gst_trace};
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use gst_net::*;
use once_cell::sync::Lazy;
@ -420,7 +420,7 @@ impl TaskImpl for UdpSrcTask {
gst_error!(CAT, obj: &self.element, "Got error {:?}", err);
match err {
SocketError::Gst(err) => {
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -428,7 +428,7 @@ impl TaskImpl for UdpSrcTask {
);
}
SocketError::Io(err) => {
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("I/O error"),
@ -474,7 +474,7 @@ impl TaskImpl for UdpSrcTask {
}
Err(err) => {
gst_error!(CAT, obj: &self.element, "Got error {}", err);
gst_element_error!(
gst::element_error!(
self.element,
gst::StreamError::Failed,
("Internal data stream error"),
@ -532,7 +532,7 @@ impl UdpSrc {
let context = Context::acquire(&settings_guard.context, settings_guard.context_wait)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
@ -554,7 +554,7 @@ impl UdpSrc {
let socket = context.enter(|| {
tokio::net::UdpSocket::from_std(socket).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to setup socket for tokio: {}", err]
)
@ -567,14 +567,14 @@ impl UdpSrc {
} else {
let addr: IpAddr = match settings_guard.address {
None => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["No address set"]
));
}
Some(ref addr) => match addr.parse() {
Err(err) => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["Invalid address '{}' set: {}", addr, err]
));
@ -623,7 +623,7 @@ impl UdpSrc {
)
}
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to create socket: {}", err]
)
@ -632,7 +632,7 @@ impl UdpSrc {
socket
.set_reuse_address(settings_guard.reuse)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to set reuse_address: {}", err]
)
@ -641,7 +641,7 @@ impl UdpSrc {
#[cfg(unix)]
{
socket.set_reuse_port(settings_guard.reuse).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to set reuse_port: {}", err]
)
@ -649,7 +649,7 @@ impl UdpSrc {
}
socket.bind(&saddr.into()).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to bind socket: {}", err]
)
@ -657,7 +657,7 @@ impl UdpSrc {
let socket = context.enter(|| {
tokio::net::UdpSocket::from_std(socket.into()).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to setup socket for tokio: {}", err]
)
@ -671,7 +671,7 @@ impl UdpSrc {
socket
.join_multicast_v4(addr, Ipv4Addr::new(0, 0, 0, 0))
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to join multicast group: {}", err]
)
@ -679,7 +679,7 @@ impl UdpSrc {
}
IpAddr::V6(addr) => {
socket.join_multicast_v6(&addr, 0).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to join multicast group: {}", err]
)
@ -712,7 +712,7 @@ impl UdpSrc {
let mut config = buffer_pool.get_config();
config.set_params(None, settings.mtu, 0, 0);
buffer_pool.set_config(config).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Settings,
["Failed to configure buffer pool {:?}", err]
)
@ -724,7 +724,7 @@ impl UdpSrc {
UdpReader::new(socket),
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to prepare socket {:?}", err]
)
@ -741,7 +741,7 @@ impl UdpSrc {
context,
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Error preparing Task: {:?}", err]
)

View file

@ -26,7 +26,7 @@ use glib::GBoxed;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::EventView;
use gst::{gst_debug, gst_error_msg, gst_info, gst_log};
use gst::{gst_debug, gst_info, gst_log};
use once_cell::sync::Lazy;
@ -258,7 +258,7 @@ mod imp_src {
let settings = self.settings.lock().unwrap().clone();
let context =
Context::acquire(&settings.context, THROTTLING_DURATION).map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to acquire Context: {}", err]
)
@ -273,7 +273,7 @@ mod imp_src {
context,
)
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Failed,
["Error preparing Task: {:?}", err]
)

View file

@ -12,7 +12,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
reqwesthttpsrc::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
reqwest,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -21,7 +21,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_trace, gst_warning};
use gst::{gst_debug, gst_error, gst_trace, gst_warning};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
@ -319,7 +319,7 @@ impl ReqwestHttpSrc {
.gzip(true)
.build()
.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to create Client: {}", err]
)
@ -485,7 +485,7 @@ impl ReqwestHttpSrc {
let future = async {
req.send().await.map_err(|err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::OpenRead,
["Failed to fetch {}: {:?}", uri, err]
)
@ -511,7 +511,7 @@ impl ReqwestHttpSrc {
match res.status() {
StatusCode::NOT_FOUND => {
gst_error!(CAT, obj: src, "Resource not found");
return Err(Some(gst_error_msg!(
return Err(Some(gst::error_msg!(
gst::ResourceError::NotFound,
["Resource '{}' not found", uri]
)));
@ -521,14 +521,14 @@ impl ReqwestHttpSrc {
| StatusCode::FORBIDDEN
| StatusCode::PROXY_AUTHENTICATION_REQUIRED => {
gst_error!(CAT, obj: src, "Not authorized: {}", res.status());
return Err(Some(gst_error_msg!(
return Err(Some(gst::error_msg!(
gst::ResourceError::NotAuthorized,
["Not Authorized for resource '{}': {}", uri, res.status()]
)));
}
_ => {
gst_error!(CAT, obj: src, "Request failed: {}", res.status());
return Err(Some(gst_error_msg!(
return Err(Some(gst::error_msg!(
gst::ResourceError::OpenRead,
["Request for '{}' failed: {}", uri, res.status()]
)));
@ -557,7 +557,7 @@ impl ReqwestHttpSrc {
};
if position != start {
return Err(Some(gst_error_msg!(
return Err(Some(gst::error_msg!(
gst::ResourceError::Seek,
["Failed to seek to {}: Got {}", start, position]
)));
@ -653,7 +653,7 @@ impl ReqwestHttpSrc {
match res {
Ok(res) => res,
Err(_) => Err(gst_error_msg!(
Err(_) => Err(gst::error_msg!(
gst::ResourceError::Read,
["Request timeout"]
)),
@ -868,7 +868,7 @@ impl BaseSrcImpl for ReqwestHttpSrc {
.location
.as_ref()
.ok_or_else(|| {
gst_error_msg!(gst::CoreError::StateChange, ["Can't start without an URI"])
gst::error_msg!(gst::CoreError::StateChange, ["Can't start without an URI"])
})
.map(|uri| uri.clone())?;
@ -876,7 +876,7 @@ impl BaseSrcImpl for ReqwestHttpSrc {
*state = self.do_request(src, uri, 0, None).map_err(|err| {
err.unwrap_or_else(|| {
gst_error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
gst::error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
})
})?;
@ -921,7 +921,7 @@ impl BaseSrcImpl for ReqwestHttpSrc {
..
} => (position, stop, uri.clone()),
State::Stopped => {
gst_element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
gst::element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
return false;
}
@ -965,7 +965,7 @@ impl PushSrcImpl for ReqwestHttpSrc {
..
} => (response, position, caps, tags),
State::Stopped => {
gst_element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
gst::element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
return Err(gst::FlowError::Error);
}
@ -977,7 +977,7 @@ impl PushSrcImpl for ReqwestHttpSrc {
Some(response) => response,
None => {
gst_error!(CAT, obj: src, "Don't have a response");
gst_element_error!(src, gst::ResourceError::Read, ["Don't have a response"]);
gst::element_error!(src, gst::ResourceError::Read, ["Don't have a response"]);
return Err(gst::FlowError::Error);
}
@ -1001,7 +1001,7 @@ impl PushSrcImpl for ReqwestHttpSrc {
let future = async {
current_response.chunk().await.map_err(move |err| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Read,
["Failed to read chunk at offset {}: {:?}", offset, err]
)
@ -1030,7 +1030,7 @@ impl PushSrcImpl for ReqwestHttpSrc {
..
} => (response, position),
State::Stopped => {
gst_element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
gst::element_error!(src, gst::LibraryError::Failed, ["Not started yet"]);
return Err(gst::FlowError::Error);
}

View file

@ -21,8 +21,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_loggable_error,
gst_warning,
element_error, error_msg, gst_debug, gst_error, gst_info, gst_log, gst_warning, loggable_error,
};
use std::default::Default;
@ -419,7 +418,7 @@ impl Transcriber {
Message::Binary(buf) => {
let (_, pkt) = parse_packet(&buf).map_err(|err| {
gst_error!(CAT, obj: element, "Failed to parse packet: {}", err);
gst_error_msg!(
error_msg!(
gst::StreamError::Failed,
["Failed to parse packet: {}", err]
)
@ -437,7 +436,7 @@ impl Transcriber {
payload,
err
);
gst_error_msg!(
error_msg!(
gst::StreamError::Failed,
["Unexpected exception message: {} ({})", payload, err]
)
@ -449,7 +448,7 @@ impl Transcriber {
message.message
);
return Err(gst_error_msg!(
return Err(error_msg!(
gst::StreamError::Failed,
["AWS raised an error: {}", message.message]
));
@ -457,7 +456,7 @@ impl Transcriber {
let mut transcript: Transcript =
serde_json::from_str(&payload).map_err(|err| {
gst_error_msg!(
error_msg!(
gst::StreamError::Failed,
["Unexpected binary message: {} ({})", payload, err]
)
@ -595,7 +594,7 @@ impl Transcriber {
let transcribe = Self::from_instance(&element);
match transcribe.loop_fn(&element, &mut receiver) {
Err(err) => {
gst_element_error!(
element_error!(
&element,
gst::StreamError::Failed,
["Streaming failed: {}", err]
@ -606,7 +605,7 @@ impl Transcriber {
};
});
if res.is_err() {
return Err(gst_loggable_error!(CAT, "Failed to start pad task"));
return Err(loggable_error!(CAT, "Failed to start pad task"));
}
Ok(())
}
@ -731,7 +730,7 @@ impl Transcriber {
EventView::Segment(e) => {
let segment = match e.get_segment().clone().downcast::<gst::ClockTime>() {
Err(segment) => {
gst_element_error!(
element_error!(
element,
gst::StreamError::Format,
[
@ -834,7 +833,7 @@ impl Transcriber {
gst_debug!(CAT, obj: element, "Handling {:?}", buffer);
self.ensure_connection(element).map_err(|err| {
gst_element_error!(
element_error!(
&element,
gst::StreamError::Failed,
["Streaming failed: {}", err]
@ -880,7 +879,7 @@ impl Transcriber {
.enter(|| futures::executor::block_on(EnvironmentProvider::default().credentials()))
.map_err(|err| {
gst_error!(CAT, obj: element, "Failed to generate credentials: {}", err);
gst_error_msg!(
error_msg!(
gst::CoreError::Failed,
["Failed to generate credentials: {}", err]
)
@ -912,7 +911,7 @@ impl Transcriber {
.enter(|| futures::executor::block_on(connect_async(format!("wss{}", &url[5..]))))
.map_err(|err| {
gst_error!(CAT, obj: element, "Failed to connect: {}", err);
gst_error_msg!(gst::CoreError::Failed, ["Failed to connect: {}", err])
error_msg!(gst::CoreError::Failed, ["Failed to connect: {}", err])
})?;
let (ws_sink, mut ws_stream) = ws.split();
@ -936,7 +935,7 @@ impl Transcriber {
Ok(msg) => msg,
Err(err) => {
gst_error!(CAT, "Failed to receive data: {}", err);
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming failed: {}", err]
@ -1027,12 +1026,7 @@ impl ObjectSubclass for Transcriber {
.activatemode_function(|pad, parent, mode, active| {
Transcriber::catch_panic_pad_function(
parent,
|| {
Err(gst_loggable_error!(
CAT,
"Panic activating src pad with mode"
))
},
|| Err(loggable_error!(CAT, "Panic activating src pad with mode")),
|transcriber, element| transcriber.src_activatemode(pad, element, mode, active),
)
})

View file

@ -20,7 +20,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
rusoto,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -12,7 +12,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_error_msg, gst_info, gst_trace};
use gst::{gst_error, gst_info, gst_trace};
use gst_base::subclass::prelude::*;
@ -55,7 +55,7 @@ impl Started {
const MAX_MULTIPART_NUMBER: i64 = 10000;
if self.part_number > MAX_MULTIPART_NUMBER {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Failed,
[
"Maximum number of parts ({}) reached.",
@ -177,7 +177,7 @@ impl S3Sink {
let output =
s3utils::wait(&self.canceller, upload_part_req_future).map_err(|err| match err {
WaitError::FutureError(err) => Some(gst_error_msg!(
WaitError::FutureError(err) => Some(gst::error_msg!(
gst::ResourceError::OpenWrite,
["Failed to upload part: {}", err]
)),
@ -247,7 +247,7 @@ impl S3Sink {
settings: &Settings,
) -> Result<CreateMultipartUploadRequest, gst::ErrorMessage> {
if settings.bucket.is_none() || settings.key.is_none() {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["Bucket or key is not defined"]
));
@ -266,7 +266,7 @@ impl S3Sink {
fn finalize_upload(&self, element: &super::S3Sink) -> Result<(), gst::ErrorMessage> {
if self.flush_current_buffer(element).is_err() {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["Failed to flush internal buffer."]
));
@ -288,12 +288,12 @@ impl S3Sink {
s3utils::wait(&self.canceller, complete_req_future)
.map(|_| ())
.map_err(|err| match err {
WaitError::FutureError(err) => gst_error_msg!(
WaitError::FutureError(err) => gst::error_msg!(
gst::ResourceError::Write,
["Failed to complete multipart upload: {}.", err.to_string()]
),
WaitError::Cancelled => {
gst_error_msg!(gst::LibraryError::Failed, ["Interrupted during stop"])
gst::error_msg!(gst::LibraryError::Failed, ["Interrupted during stop"])
}
})
}
@ -313,18 +313,18 @@ impl S3Sink {
let response = s3utils::wait(&self.canceller, create_multipart_req_future).map_err(
|err| match err {
WaitError::FutureError(err) => gst_error_msg!(
WaitError::FutureError(err) => gst::error_msg!(
gst::ResourceError::OpenWrite,
["Failed to create multipart upload: {}", err]
),
WaitError::Cancelled => {
gst_error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
gst::error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
}
},
)?;
let upload_id = response.upload_id.ok_or_else(|| {
gst_error_msg!(
gst::error_msg!(
gst::ResourceError::Failed,
["Failed to get multipart upload ID"]
)
@ -484,13 +484,13 @@ impl BaseSinkImpl for S3Sink {
buffer: &gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> {
if let State::Stopped = *self.state.lock().unwrap() {
gst_element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
gst::element_error!(element, gst::CoreError::Failed, ["Not started yet"]);
return Err(gst::FlowError::Error);
}
gst_trace!(CAT, obj: element, "Rendering {:?}", buffer);
let map = buffer.map_readable().map_err(|_| {
gst_element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
gst::element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
gst::FlowError::Error
})?;

View file

@ -18,7 +18,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_error_msg, gst_info};
use gst::{gst_debug, gst_error, gst_info};
use gst_base::prelude::*;
use gst_base::subclass::base_src::CreateSuccess;
@ -120,12 +120,12 @@ impl S3Src {
let response = client.head_object(request);
let output = s3utils::wait(&self.canceller, response).map_err(|err| match err {
WaitError::FutureError(err) => gst_error_msg!(
WaitError::FutureError(err) => gst::error_msg!(
gst::ResourceError::NotFound,
["Failed to HEAD object: {}", err]
),
WaitError::Cancelled => {
gst_error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
gst::error_msg!(gst::LibraryError::Failed, ["Interrupted during start"])
}
})?;
@ -133,7 +133,7 @@ impl S3Src {
gst_info!(CAT, obj: src, "HEAD success, content length = {}", size);
Ok(size as u64)
} else {
Err(gst_error_msg!(
Err(gst::error_msg!(
gst::ResourceError::Read,
["Failed to get content length"]
))
@ -156,7 +156,7 @@ impl S3Src {
..
} => (url, client),
StreamingState::Stopped => {
return Err(Some(gst_error_msg!(
return Err(Some(gst::error_msg!(
gst::LibraryError::Failed,
["Cannot GET before start()"]
)));
@ -182,7 +182,7 @@ impl S3Src {
let response = client.get_object(request);
let output = s3utils::wait(&self.canceller, response).map_err(|err| match err {
WaitError::FutureError(err) => Some(gst_error_msg!(
WaitError::FutureError(err) => Some(gst::error_msg!(
gst::ResourceError::Read,
["Could not read: {}", err]
)),
@ -197,7 +197,7 @@ impl S3Src {
);
s3utils::wait_stream(&self.canceller, &mut output.body.unwrap()).map_err(|err| match err {
WaitError::FutureError(err) => Some(gst_error_msg!(
WaitError::FutureError(err) => Some(gst::error_msg!(
gst::ResourceError::Read,
["Could not read: {}", err]
)),
@ -330,7 +330,7 @@ impl BaseSrcImpl for S3Src {
let s3url = match *self.url.lock().unwrap() {
Some(ref url) => url.clone(),
None => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::ResourceError::Settings,
["Cannot start without a URL being set"]
));

View file

@ -23,7 +23,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gsttextwrap::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
rstextwrap,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -26,7 +26,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
// Plugin name, plugin description, plugin entry point function, version number of this plugin,
// license of the plugin, source package name, binary package name, origin where it comes from
// and the date/time of release.
gst::gst_plugin_define!(
gst::plugin_define!(
rstutorial,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -10,7 +10,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_info, gst_loggable_error};
use gst::{gst_debug, gst_info};
use gst_base::subclass::prelude::*;
use std::i32;
@ -382,11 +382,11 @@ impl BaseTransformImpl for Rgb2Gray {
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
Err(_) => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
Err(_) => return Err(gst::loggable_error!(CAT, "Failed to parse input caps")),
Ok(info) => info,
};
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
Err(_) => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
Err(_) => return Err(gst::loggable_error!(CAT, "Failed to parse output caps")),
Ok(info) => info,
};
@ -429,7 +429,7 @@ impl BaseTransformImpl for Rgb2Gray {
// Get a locked reference to our state, i.e. the input and output VideoInfo
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().ok_or_else(|| {
gst_element_error!(element, gst::CoreError::Negotiation, ["Have no state yet"]);
gst::element_error!(element, gst::CoreError::Negotiation, ["Have no state yet"]);
gst::FlowError::NotNegotiated
})?;
@ -444,7 +444,7 @@ impl BaseTransformImpl for Rgb2Gray {
let in_frame =
gst_video::VideoFrameRef::from_buffer_ref_readable(inbuf.as_ref(), &state.in_info)
.map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map input buffer readable"]
@ -456,7 +456,7 @@ impl BaseTransformImpl for Rgb2Gray {
let mut out_frame =
gst_video::VideoFrameRef::from_buffer_ref_writable(outbuf, &state.out_info).map_err(
|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map output buffer writable"]

View file

@ -10,7 +10,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_info, gst_log, gst_loggable_error};
use gst::{gst_debug, gst_error, gst_info, gst_log};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
@ -431,7 +431,7 @@ impl BaseSrcImpl for SineSrc {
use std::f64::consts::PI;
let info = gst_audio::AudioInfo::from_caps(caps).map_err(|_| {
gst_loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps)
gst::loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps)
})?;
gst_debug!(CAT, obj: element, "Configuring for caps {}", caps);
@ -691,7 +691,7 @@ impl PushSrcImpl for SineSrc {
let mut state = self.state.lock().unwrap();
let info = match state.info {
None => {
gst_element_error!(element, gst::CoreError::Negotiation, ["Have no caps yet"]);
gst::element_error!(element, gst::CoreError::Negotiation, ["Have no caps yet"]);
return Err(gst::FlowError::NotNegotiated);
}
Some(ref info) => info.clone(),

View file

@ -75,7 +75,7 @@ Lets start editing `src/lib.rs` to make this an actual GStreamer plugin.
Next we make use of the `gst_plugin_define!` `macro` from the `gstreamer` crate to set-up the static metadata of the plugin (and make the shared library recognizeable by GStreamer to be a valid plugin), and to define the name of our entry point function (`plugin_init`) where we will register all the elements that this plugin provides.
```rust
gst::gst_plugin_define!(
gst::plugin_define!(
rstutorial,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
@ -149,7 +149,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_info, gst_loggable_error};
use gst::{gst_debug, gst_info};
use gst_base::subclass::prelude::*;
use std::i32;
@ -452,11 +452,11 @@ impl BaseTransformImpl for Rgb2Gray {
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
None => return Err(gst::loggable_error!(CAT, "Failed to parse input caps")),
Some(info) => info,
};
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
None => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
None => return Err(gst::loggable_error!(CAT, "Failed to parse output caps")),
Some(info) => info,
};
@ -606,14 +606,14 @@ impl BaseTransformImpl for Rgb2Gray {
) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().ok_or_else(|| {
gst_element_error!(element, gst::CoreError::Negotiation, ["Have no state yet"]);
gst::element_error!(element, gst::CoreError::Negotiation, ["Have no state yet"]);
gst::FlowError::NotNegotiated
})?;
let in_frame =
gst_video::VideoFrameRef::from_buffer_ref_readable(inbuf.as_ref(), &state.in_info)
.ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map input buffer readable"]
@ -624,7 +624,7 @@ impl BaseTransformImpl for Rgb2Gray {
let mut out_frame =
gst_video::VideoFrameRef::from_buffer_ref_writable(outbuf, &state.out_info)
.ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map output buffer writable"]

View file

@ -26,7 +26,7 @@ use glib::prelude::*;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_info, gst_log, gst_loggable_error};
use gst::{gst_debug, gst_error, gst_info, gst_log};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
@ -430,7 +430,7 @@ First of all, we need to get notified whenever the caps that our source is confi
use std::f64::consts::PI;
let info = gst_audio::AudioInfo::from_caps(caps).map_err(|_| {
gst_loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps)
gst::loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps)
})?;
gst_debug!(CAT, obj: element, "Configuring for caps {}", caps);
@ -588,7 +588,7 @@ Now that this is done, we need to implement the `PushSrc::create` virtual meth
let mut state = self.state.lock().unwrap();
let info = match state.info {
None => {
gst_element_error!(element, gst::CoreError::Negotiation, ["Have no caps yet"]);
gst::element_error!(element, gst::CoreError::Negotiation, ["Have no caps yet"]);
return Err(gst::FlowReturn::NotNegotiated);
}
Some(ref info) => info.clone(),

View file

@ -13,7 +13,6 @@ use glib::subclass::prelude::*;
use glib::translate::*;
use gst::subclass::prelude::*;
use gst::{gst_error_msg, gst_panic_to_error, gst_result_from_gboolean};
use std::ptr;
@ -419,7 +418,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
match (*parent_class).src_activate {
None => Ok(()),
Some(f) => gst_result_from_gboolean!(
Some(f) => gst::result_from_gboolean!(
f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
mode.to_glib(),
@ -465,7 +464,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
{
Ok(())
} else {
Err(gst_error_msg!(
Err(gst::error_msg!(
gst::CoreError::Failed,
["Parent function `start` failed"]
))
@ -489,7 +488,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
{
Ok(())
} else {
Err(gst_error_msg!(
Err(gst::error_msg!(
gst::CoreError::Failed,
["Parent function `stop` failed"]
))
@ -585,7 +584,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
(*parent_class)
.negotiated_src_caps
.map(|f| {
gst_result_from_gboolean!(
gst::result_from_gboolean!(
f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
caps.to_glib_none().0
@ -656,7 +655,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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()
})
.to_glib()
@ -674,7 +673,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
let ret = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
let ret = gst::panic_to_error!(&wrap, &instance.panicked(), None, {
imp.clip(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@ -696,7 +695,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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))
.into()
})
@ -715,7 +714,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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_borrow(aggregator_pad),
@ -737,7 +736,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@ -760,7 +759,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@ -782,7 +781,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.sink_query_pre_queue(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@ -803,7 +802,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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))
})
.to_glib()
@ -820,7 +819,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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))
})
.to_glib()
@ -838,7 +837,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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)) {
Ok(()) => true,
Err(err) => {
@ -861,7 +860,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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))
.into()
})
@ -878,7 +877,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true,
Err(err) => {
@ -900,7 +899,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true,
Err(err) => {
@ -922,7 +921,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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())
})
.to_glib()
@ -941,7 +940,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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);
imp.create_new_pad(
@ -970,7 +969,7 @@ where
*res = ptr::null_mut();
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)) {
Ok(res_caps) => {
*res = res_caps.into_ptr();
@ -993,7 +992,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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))
})
.into_ptr()
@ -1010,7 +1009,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
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)) {
Ok(()) => true,
Err(err) => {
@ -1032,7 +1031,7 @@ where
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref())
})
.to_glib()

View file

@ -20,7 +20,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg};
use gst::{gst_debug, gst_error};
use std::{mem, sync::Mutex};
@ -189,7 +189,7 @@ impl CustomSource {
.any(|templ| templ.get_property_presence() == gst::PadPresence::Request)
{
gst_error!(CAT, obj: element, "Request pads not supported");
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Settings,
["Request pads not supported"]
@ -286,7 +286,7 @@ impl CustomSource {
caps if !caps.is_any() && !caps.is_empty() => caps,
_ => {
gst_error!(CAT, obj: element, "Pad {} had no caps", pad.get_name());
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::CoreError::Negotiation,
["Pad had no caps"]
));

View file

@ -20,7 +20,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_warning};
use gst::{gst_debug, gst_error, gst_info, gst_warning};
use std::mem;
use std::sync::Mutex;
@ -896,7 +896,7 @@ impl FallbackSrc {
Some(source) => source,
None => {
gst_error!(CAT, obj: element, "No URI or source element configured");
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Settings,
["No URI or source element configured"]
@ -1179,7 +1179,7 @@ impl FallbackSrc {
"Failed to link source pad to clocksync: {}",
err
);
gst_error_msg!(
gst::error_msg!(
gst::CoreError::Negotiation,
["Failed to link source pad to clocksync: {}", err]
)
@ -1382,7 +1382,7 @@ impl FallbackSrc {
};
let segment = segment.downcast_ref::<gst::ClockTime>().ok_or_else(|| {
gst_error!(CAT, obj: element, "Have no time segment");
gst_error_msg!(gst::CoreError::Clock, ["Have no time segment"])
gst::error_msg!(gst::CoreError::Clock, ["Have no time segment"])
})?;
let running_time = if pts < segment.get_start() {

View file

@ -21,7 +21,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_element_warning, gst_error, gst_info, gst_warning};
use gst::{gst_debug, gst_error, gst_info, gst_warning};
use std::sync::{atomic::AtomicBool, atomic::Ordering, Mutex};
@ -341,7 +341,7 @@ impl VideoFallbackSource {
obj: element,
"imagefreeze does not support live mode, this will probably misbehave"
);
gst_element_warning!(
gst::element_warning!(
element,
gst::LibraryError::Settings,
["imagefreeze does not support live mode, this will probably misbehave"]
@ -382,7 +382,7 @@ impl VideoFallbackSource {
.expect("pngdec not found");
} else {
gst_error!(CAT, obj: &element, "Unsupported caps {}", caps);
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Unsupported caps {}", caps]
@ -396,7 +396,7 @@ impl VideoFallbackSource {
gst::Element::link_many(&[&typefind, &decoder, &videoconvert])
{
gst_error!(CAT, obj: &element, "Can't link fallback image decoder");
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Can't link fallback image decoder"]

View file

@ -28,7 +28,9 @@ use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use glib::subclass;
#[cfg(not(feature = "v1_18"))]
use glib::subclass::prelude::*;
#[cfg(not(feature = "v1_18"))]
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_info, gst_log, gst_warning};

View file

@ -28,7 +28,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
fallbackswitch,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -21,7 +21,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
togglerecord::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
togglerecord,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -20,7 +20,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_log, gst_trace, gst_warning};
use gst::{gst_debug, gst_log, gst_trace, gst_warning};
use more_asserts::{assert_ge, assert_le, assert_lt};
@ -382,7 +382,7 @@ impl ToggleRecord {
let duration = data.get_duration(&state);
if !dts_or_pts.is_some() {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Buffer without DTS or PTS"]
@ -632,13 +632,13 @@ impl ToggleRecord {
let duration = data.get_duration(&state);
if pts.is_none() {
gst_element_error!(element, gst::StreamError::Format, ["Buffer without PTS"]);
gst::element_error!(element, gst::StreamError::Format, ["Buffer without PTS"]);
return Err(gst::FlowError::Error);
}
let dts = data.get_dts();
if dts.is_some() && pts.is_some() && dts != pts {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["DTS != PTS not supported for secondary streams"]
@ -647,7 +647,7 @@ impl ToggleRecord {
}
if !data.is_keyframe() {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Delta-units not supported for secondary streams"]
@ -1042,7 +1042,7 @@ impl ToggleRecord {
buffer: gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let stream = self.pads.lock().get(pad).cloned().ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]
@ -1157,7 +1157,7 @@ impl ToggleRecord {
let stream = match self.pads.lock().get(pad) {
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]
@ -1216,7 +1216,7 @@ impl ToggleRecord {
let segment = match e.get_segment().clone().downcast::<gst::ClockTime>() {
Err(segment) => {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
[
@ -1230,7 +1230,7 @@ impl ToggleRecord {
};
if (segment.get_rate() - 1.0).abs() > f64::EPSILON {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
[
@ -1346,7 +1346,7 @@ impl ToggleRecord {
) -> bool {
let stream = match self.pads.lock().get(pad) {
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]
@ -1374,7 +1374,7 @@ impl ToggleRecord {
let stream = match self.pads.lock().get(pad) {
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]
@ -1415,7 +1415,7 @@ impl ToggleRecord {
let stream = match self.pads.lock().get(pad) {
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]
@ -1534,7 +1534,7 @@ impl ToggleRecord {
) -> gst::Iterator<gst::Pad> {
let stream = match self.pads.lock().get(pad) {
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Pad,
["Unknown pad {:?}", pad.get_name()]

View file

@ -17,7 +17,7 @@
//! Inside `lib.rs` of the plugin, the information provided by `get_info` are usable as follows:
//!
//! ```rust,ignore
//! gst_plugin_define!(
//! plugin_define!(
//! the_plugin_name,
//! env!("CARGO_PKG_DESCRIPTION"),
//! plugin_init,

View file

@ -8,8 +8,8 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::gst_debug;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error};
use gst_video::prelude::VideoDecoderExtManual;
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
@ -127,7 +127,7 @@ impl VideoDecoderImpl for CdgDec {
let cmd = {
let input = frame.get_input_buffer().unwrap();
let map = input.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map input buffer readable"]
@ -159,7 +159,7 @@ impl VideoDecoderImpl for CdgDec {
let mut out_frame =
gst_video::VideoFrameRef::from_buffer_ref_writable(output, info.as_ref().unwrap())
.map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map output buffer writable"]
@ -208,7 +208,7 @@ impl VideoDecoderImpl for CdgDec {
let mut config = pool.get_config();
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
pool.set_config(config).map_err(|e| {
gst::gst_error_msg!(gst::CoreError::Negotiation, [&e.message])
gst::error_msg!(gst::CoreError::Negotiation, [&e.message])
})?;
}
}

View file

@ -9,9 +9,9 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::format::Bytes;
use gst::gst_debug;
use gst::subclass::prelude::*;
use gst::SECOND_VAL;
use gst::{gst_debug, gst_element_error};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use once_cell::sync::Lazy;
@ -151,7 +151,7 @@ impl BaseParseImpl for CdgParse {
let input = frame.get_buffer().unwrap();
let skip = {
let map = input.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map input buffer readable"]
@ -175,7 +175,7 @@ impl BaseParseImpl for CdgParse {
let (keyframe, header) = {
let map = input.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map input buffer readable"]

View file

@ -18,7 +18,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
cdg,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -19,7 +19,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_element_warning, gst_loggable_error, gst_trace, gst_warning};
use gst::{gst_trace, gst_warning};
use gst_base::subclass::prelude::*;
use byteorder::{BigEndian, ByteOrder};
@ -489,7 +489,7 @@ impl BaseTransformImpl for CCDetect {
let map = buf.map_readable().map_err(|_| gst::FlowError::Error)?;
if buf.get_pts().is_none() {
gst_element_error!(
gst::element_error!(
element,
gst::ResourceError::Read,
["Input buffers must have valid timestamps"]
@ -507,7 +507,7 @@ impl BaseTransformImpl for CCDetect {
Ok(v) => v,
Err(e) => {
gst_warning!(CAT, "{}", &e.to_string());
gst_element_warning!(element, gst::StreamError::Decode, [&e.to_string()]);
gst::element_warning!(element, gst::StreamError::Decode, [&e.to_string()]);
CCPacketContents {
cc608: false,
cc708: false,
@ -545,7 +545,7 @@ impl BaseTransformImpl for CCDetect {
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
if incaps != outcaps {
return Err(gst_loggable_error!(
return Err(gst::loggable_error!(
CAT,
"Input and output caps are not the same"
));
@ -553,15 +553,15 @@ impl BaseTransformImpl for CCDetect {
let s = incaps
.get_structure(0)
.ok_or_else(|| gst_loggable_error!(CAT, "Failed to parse input caps"))?;
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let format_str = s
.get::<&str>("format")
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse input caps"))?
.ok_or_else(|| gst_loggable_error!(CAT, "Failed to parse input caps"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))?
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let cc_format = match format_str {
"cdp" => CCFormat::Cc708Cdp,
"cc_data" => CCFormat::Cc708CcData,
_ => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
_ => return Err(gst::loggable_error!(CAT, "Failed to parse input caps")),
};
*self.state.lock().unwrap() = Some(State {

View file

@ -19,7 +19,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use gst::{gst_error, gst_log, gst_trace};
use gst_video::prelude::*;
use once_cell::sync::Lazy;
@ -87,7 +87,7 @@ impl Cea608Overlay {
let fontmap = match pangocairo::FontMap::new() {
Some(fontmap) => Ok(fontmap),
None => {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
["Failed to create pangocairo font map"]
@ -98,7 +98,7 @@ impl Cea608Overlay {
let context = match fontmap.create_context() {
Some(context) => Ok(context),
None => {
gst_element_error!(
gst::element_error!(
element,
gst::LibraryError::Failed,
["Failed to create font map context"]
@ -242,7 +242,7 @@ impl Cea608Overlay {
let video_info = match state.video_info.as_ref() {
Some(video_info) => Ok(video_info),
None => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Negotiation,
["Element hasn't received valid video caps at negotiation time"]

View file

@ -46,7 +46,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
rsclosedcaption,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -21,7 +21,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::structure;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use gst::{gst_error, gst_log, gst_trace};
use chrono::prelude::*;
use uuid::Uuid;
@ -300,7 +300,7 @@ impl MccEnc {
let meta = buffer
.get_meta::<gst_video::VideoTimeCodeMeta>()
.ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Stream with timecodes on each buffer required"]
@ -312,7 +312,7 @@ impl MccEnc {
let _ = write!(outbuf, "{}\t", meta.get_tc());
let map = buffer.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Failed to map buffer readable"]
@ -323,7 +323,7 @@ impl MccEnc {
let len = map.len();
if len >= 256 {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Too big buffer: {}", map.len()]

View file

@ -21,8 +21,8 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_error, gst_fixme, gst_info, gst_log, gst_loggable_error,
gst_trace, gst_warning,
element_error, gst_debug, gst_error, gst_fixme, gst_info, gst_log, gst_trace, gst_warning,
loggable_error,
};
use gst_video::ValidVideoTimeCode;
@ -197,7 +197,7 @@ impl State {
.as_ref()
.map(Clone::clone)
.ok_or_else(|| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Invalid first timecode {:?}", timecode]
@ -382,7 +382,7 @@ impl MccParse {
let drain;
if let Some(buffer) = buffer {
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
gst_element_error!(
element_error!(
element,
gst::ResourceError::Read,
["Failed to map buffer readable"]
@ -412,7 +412,7 @@ impl MccParse {
);
if scan_tc_rate {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Found caption line while scanning for timecode rate"]
@ -458,7 +458,7 @@ impl MccParse {
assert!(state.seeking);
if scan_tc_rate {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Found caption line while scanning for timecode rate"]
@ -487,7 +487,7 @@ impl MccParse {
gst_debug!(CAT, obj: element, "Got line '{:?}'", line);
}
Err((line, err)) => {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Couldn't parse line '{:?}': {:?}", line, err]
@ -497,7 +497,7 @@ impl MccParse {
}
Ok(None) => {
if scan_tc_rate {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Found end of input while scanning for timecode rate"]
@ -638,7 +638,7 @@ impl MccParse {
parse.loop_fn(&element);
});
if res.is_err() {
return Err(gst_loggable_error!(CAT, "Failed to start pad task"));
return Err(loggable_error!(CAT, "Failed to start pad task"));
}
Ok(())
}
@ -671,19 +671,13 @@ impl MccParse {
let mut q = gst::query::Duration::new(gst::Format::Bytes);
if !self.sinkpad.peer_query(&mut q) {
return Err(gst_loggable_error!(
CAT,
"Failed to query upstream duration"
));
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
}
let size = match q.get_result().try_into().unwrap() {
gst::format::Bytes(Some(size)) => size,
gst::format::Bytes(None) => {
return Err(gst_loggable_error!(
CAT,
"Failed to query upstream duration"
));
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
}
};
@ -701,7 +695,7 @@ impl MccParse {
buffers.push(buffer);
}
Err(flow) => {
return Err(gst_loggable_error!(
return Err(loggable_error!(
CAT,
"Failed to pull buffer while scanning duration: {:?}",
flow
@ -716,7 +710,7 @@ impl MccParse {
let buf = buf
.clone()
.into_mapped_buffer_readable()
.map_err(|_| gst_loggable_error!(CAT, "Failed to map buffer readable"))?;
.map_err(|_| loggable_error!(CAT, "Failed to map buffer readable"))?;
reader.push(buf);
}
@ -727,7 +721,7 @@ impl MccParse {
{
let state = self.state.lock().unwrap();
let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse timecode rate"))?;
.map_err(|_| loggable_error!(CAT, "Failed to parse timecode rate"))?;
last_tc = match parse_timecode(framerate, drop_frame, tc) {
Ok(mut timecode) => {
/* We're looking for the total duration */
@ -779,7 +773,7 @@ impl MccParse {
}
}
Err(_) => {
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming stopped, failed to parse timecode rate"]
@ -815,7 +809,7 @@ impl MccParse {
Err(flow) => {
gst_error!(CAT, obj: &self.sinkpad, "Failed to pull, reason: {:?}", flow);
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming stopped, failed to pull buffer"]
@ -844,7 +838,7 @@ impl MccParse {
Err(err) => {
err.log();
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Failed to scan duration"]
@ -870,7 +864,7 @@ impl MccParse {
gst_error!(CAT, obj: element, "Pausing after flow {:?}", flow);
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming stopped, reason: {:?}", flow]
@ -1142,19 +1136,14 @@ impl ObjectSubclass for MccParse {
.activate_function(|pad, parent| {
MccParse::catch_panic_pad_function(
parent,
|| Err(gst_loggable_error!(CAT, "Panic activating sink pad")),
|| Err(loggable_error!(CAT, "Panic activating sink pad")),
|parse, element| parse.sink_activate(pad, element),
)
})
.activatemode_function(|pad, parent, mode, active| {
MccParse::catch_panic_pad_function(
parent,
|| {
Err(gst_loggable_error!(
CAT,
"Panic activating sink pad with mode"
))
},
|| Err(loggable_error!(CAT, "Panic activating sink pad with mode")),
|parse, element| parse.sink_activatemode(pad, element, mode, active),
)
})

View file

@ -21,7 +21,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::structure;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use gst::{gst_error, gst_log, gst_trace};
use gst_video::{self, ValidVideoTimeCode};
use once_cell::sync::Lazy;
@ -80,7 +80,7 @@ impl State {
assert!(self.internal_buffer.len() < MAXIMUM_PACKETES_PER_LINE);
if buffer.get_size() != 2 {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Wrongly sized CEA608 packet: {}", buffer.get_size()]
@ -92,7 +92,7 @@ impl State {
let mut timecode = buffer
.get_meta::<gst_video::VideoTimeCodeMeta>()
.ok_or_else(|| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Stream with timecodes on each buffer required"]
@ -157,7 +157,7 @@ impl State {
let first_buf = self.internal_buffer.first().unwrap();
for buffer in self.internal_buffer.iter() {
let map = buffer.map_readable().map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Failed to map buffer readable"]

View file

@ -21,8 +21,8 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_error, gst_fixme, gst_info, gst_log, gst_loggable_error,
gst_trace, gst_warning,
element_error, gst_debug, gst_error, gst_fixme, gst_info, gst_log, gst_trace, gst_warning,
loggable_error,
};
use std::cmp;
@ -163,7 +163,7 @@ impl State {
.as_ref()
.map(Clone::clone)
.ok_or_else(|| {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Invalid first timecode {:?}", timecode]
@ -300,7 +300,7 @@ impl SccParse {
let drain;
if let Some(buffer) = buffer {
let buffer = buffer.into_mapped_buffer_readable().map_err(|_| {
gst_element_error!(
element_error!(
element,
gst::ResourceError::Read,
["Failed to map buffer readable"]
@ -325,7 +325,7 @@ impl SccParse {
gst_debug!(CAT, obj: element, "Got line '{:?}'", line);
}
Err((line, err)) => {
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Couldn't parse line '{:?}': {:?}", line, err]
@ -523,7 +523,7 @@ impl SccParse {
parse.loop_fn(&element);
});
if res.is_err() {
return Err(gst_loggable_error!(CAT, "Failed to start pad task"));
return Err(loggable_error!(CAT, "Failed to start pad task"));
}
Ok(())
}
@ -556,19 +556,13 @@ impl SccParse {
let mut q = gst::query::Duration::new(gst::Format::Bytes);
if !self.sinkpad.peer_query(&mut q) {
return Err(gst_loggable_error!(
CAT,
"Failed to query upstream duration"
));
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
}
let size = match q.get_result().try_into().unwrap() {
gst::format::Bytes(Some(size)) => size,
gst::format::Bytes(None) => {
return Err(gst_loggable_error!(
CAT,
"Failed to query upstream duration"
));
return Err(loggable_error!(CAT, "Failed to query upstream duration"));
}
};
@ -586,7 +580,7 @@ impl SccParse {
buffers.push(buffer);
}
Err(flow) => {
return Err(gst_loggable_error!(
return Err(loggable_error!(
CAT,
"Failed to pull buffer while scanning duration: {:?}",
flow
@ -601,7 +595,7 @@ impl SccParse {
let buf = buf
.clone()
.into_mapped_buffer_readable()
.map_err(|_| gst_loggable_error!(CAT, "Failed to map buffer readable"))?;
.map_err(|_| loggable_error!(CAT, "Failed to map buffer readable"))?;
reader.push(buf);
}
@ -688,7 +682,7 @@ impl SccParse {
Err(flow) => {
gst_error!(CAT, obj: &self.sinkpad, "Failed to pull, reason: {:?}", flow);
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming stopped, failed to pull buffer"]
@ -716,7 +710,7 @@ impl SccParse {
Err(err) => {
err.log();
gst_element_error!(
element_error!(
element,
gst::StreamError::Decode,
["Failed to scan duration"]
@ -742,7 +736,7 @@ impl SccParse {
gst_error!(CAT, obj: element, "Pausing after flow {:?}", flow);
gst_element_error!(
element_error!(
element,
gst::StreamError::Failed,
["Streaming stopped, reason: {:?}", flow]
@ -1011,19 +1005,14 @@ impl ObjectSubclass for SccParse {
.activate_function(|pad, parent| {
SccParse::catch_panic_pad_function(
parent,
|| Err(gst_loggable_error!(CAT, "Panic activating sink pad")),
|| Err(loggable_error!(CAT, "Panic activating sink pad")),
|parse, element| parse.sink_activate(pad, element),
)
})
.activatemode_function(|pad, parent, mode, active| {
SccParse::catch_panic_pad_function(
parent,
|| {
Err(gst_loggable_error!(
CAT,
"Panic activating sink pad with mode"
))
},
|| Err(loggable_error!(CAT, "Panic activating sink pad with mode")),
|parse, element| parse.sink_activatemode(pad, element, mode, active),
)
})

View file

@ -20,7 +20,7 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_log, gst_trace, gst_warning};
use gst::{gst_debug, gst_error, gst_log, gst_trace, gst_warning};
use once_cell::sync::Lazy;
@ -346,7 +346,7 @@ impl TtToCea608 {
) -> Result<gst::FlowSuccess, gst::FlowError> {
let pts = match buffer.get_pts() {
gst::CLOCK_TIME_NONE => {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Stream with timestamped buffers required"]
@ -358,7 +358,7 @@ impl TtToCea608 {
let duration = match buffer.get_duration() {
gst::CLOCK_TIME_NONE => {
gst_element_error!(
gst::element_error!(
element,
gst::StreamError::Format,
["Buffers of stream need to have a duration"]

View file

@ -488,7 +488,7 @@ impl VideoDecoderImpl for Dav1dDec {
let mut config = pool.get_config();
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
pool.set_config(config).map_err(|e| {
gst::gst_error_msg!(gst::CoreError::Negotiation, [&e.message])
gst::error_msg!(gst::CoreError::Negotiation, [&e.message])
})?;
self.negotiation_infos.lock().unwrap().video_meta_supported = true;
}

View file

@ -13,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst::gst_plugin_define!(
gst::plugin_define!(
rsdav1d,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -16,9 +16,7 @@ use ::flavors::parser as flavors;
use glib::subclass;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_error, gst_error_msg, gst_log, gst_loggable_error, gst_trace, gst_warning,
};
use gst::{gst_debug, gst_error, gst_log, gst_trace, gst_warning};
use num_rational::Rational32;
@ -137,7 +135,7 @@ impl ObjectSubclass for FlvDemux {
.activate_function(|pad, parent| {
FlvDemux::catch_panic_pad_function(
parent,
|| Err(gst_loggable_error!(CAT, "Panic activating sink pad")),
|| Err(gst::loggable_error!(CAT, "Panic activating sink pad")),
|demux, element| demux.sink_activate(pad, element),
)
})
@ -145,7 +143,7 @@ impl ObjectSubclass for FlvDemux {
FlvDemux::catch_panic_pad_function(
parent,
|| {
Err(gst_loggable_error!(
Err(gst::loggable_error!(
CAT,
"Panic activating sink pad with mode"
))
@ -293,7 +291,7 @@ impl FlvDemux {
let mode = {
let mut query = gst::query::Scheduling::new();
if !pad.peer_query(&mut query) {
return Err(gst_loggable_error!(CAT, "Scheduling query failed on peer"));
return Err(gst::loggable_error!(CAT, "Scheduling query failed on peer"));
}
// TODO: pull mode
@ -324,7 +322,7 @@ impl FlvDemux {
if active {
self.start(element, mode).map_err(|err| {
element.post_error_message(err);
gst_loggable_error!(CAT, "Failed to start element with mode {:?}", mode)
gst::loggable_error!(CAT, "Failed to start element with mode {:?}", mode)
})?;
if mode == gst::PadMode::Pull {
@ -339,7 +337,7 @@ impl FlvDemux {
self.stop(element).map_err(|err| {
element.post_error_message(err);
gst_loggable_error!(CAT, "Failed to stop element")
gst::loggable_error!(CAT, "Failed to stop element")
})?;
}
@ -718,7 +716,7 @@ impl StreamingState {
let tag_header = match flavors::tag_header(&data[4..]) {
Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => {
return Err(gst_error_msg!(
return Err(gst::error_msg!(
gst::StreamError::Demux,
["Invalid tag header: {:?}", err]
));

View file

@ -13,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
flvdemux::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
rsflv,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,8 +9,8 @@
use atomic_refcell::AtomicRefCell;
use glib::subclass;
use glib::subclass::prelude::*;
use gst::gst_debug;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_loggable_error};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
@ -254,7 +254,7 @@ impl VideoEncoderImpl for GifEnc {
state: &gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>,
) -> Result<(), gst::LoggableError> {
self.flush_encoder(element)
.map_err(|_| gst_loggable_error!(CAT, "Failed to drain"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?;
let video_info = state.get_info();
gst_debug!(CAT, obj: element, "Setting format {:?}", video_info);
@ -268,10 +268,10 @@ impl VideoEncoderImpl for GifEnc {
let output_state = element
.set_output_state(gst::Caps::new_simple("image/gif", &[]), Some(state))
.map_err(|_| gst_loggable_error!(CAT, "Failed to set output state"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to set output state"))?;
element
.negotiate(output_state)
.map_err(|_| gst_loggable_error!(CAT, "Failed to negotiate"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to negotiate"))?;
self.parent_set_format(element, state)
}
@ -305,7 +305,7 @@ impl VideoEncoderImpl for GifEnc {
&state.video_info,
)
.map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map output buffer readable"]
@ -326,7 +326,7 @@ impl VideoEncoderImpl for GifEnc {
}
let frame_delay = in_frame.buffer().get_pts() - state.gif_pts.unwrap();
if frame_delay.is_none() {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["No PTS set on input frame. Unable to calculate proper frame timing."]
@ -367,7 +367,7 @@ impl VideoEncoderImpl for GifEnc {
// encode new frame
let context = state.context.as_mut().unwrap();
if let Err(e) = context.write_frame(&gif_frame) {
gst_element_error!(element, gst::CoreError::Failed, [&e.to_string()]);
gst::element_error!(element, gst::CoreError::Failed, [&e.to_string()]);
return Err(gst::FlowError::Error);
}
}

View file

@ -12,7 +12,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gifenc::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
gif,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -12,7 +12,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
rav1enc::register(plugin)
}
gst::gst_plugin_define!(
gst::plugin_define!(
rav1e,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,8 +9,8 @@
use atomic_refcell::AtomicRefCell;
use glib::subclass;
use glib::subclass::prelude::*;
use gst::gst_debug;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_loggable_error};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
@ -490,7 +490,7 @@ impl VideoEncoderImpl for Rav1Enc {
state: &gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>,
) -> Result<(), gst::LoggableError> {
self.finish(element)
.map_err(|_| gst_loggable_error!(CAT, "Failed to drain"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?;
let video_info = state.get_info();
gst_debug!(CAT, obj: element, "Setting format {:?}", video_info);
@ -612,11 +612,11 @@ impl VideoEncoderImpl for Rav1Enc {
*self.state.borrow_mut() = Some(State {
context: if video_info.format_info().depth()[0] > 8 {
Context::Sixteen(cfg.new_context().map_err(|err| {
gst_loggable_error!(CAT, "Failed to create context: {:?}", err)
gst::loggable_error!(CAT, "Failed to create context: {:?}", err)
})?)
} else {
Context::Eight(cfg.new_context().map_err(|err| {
gst_loggable_error!(CAT, "Failed to create context: {:?}", err)
gst::loggable_error!(CAT, "Failed to create context: {:?}", err)
})?)
},
video_info,
@ -624,10 +624,10 @@ impl VideoEncoderImpl for Rav1Enc {
let output_state = element
.set_output_state(gst::Caps::new_simple("video/x-av1", &[]), Some(state))
.map_err(|_| gst_loggable_error!(CAT, "Failed to set output state"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to set output state"))?;
element
.negotiate(output_state)
.map_err(|_| gst_loggable_error!(CAT, "Failed to negotiate"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to negotiate"))?;
self.parent_set_format(element, state)
}
@ -685,7 +685,7 @@ impl VideoEncoderImpl for Rav1Enc {
let in_frame =
gst_video::VideoFrameRef::from_buffer_ref_readable(&*input_buffer, &state.video_info)
.map_err(|_| {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to map output buffer readable"]
@ -708,7 +708,7 @@ impl VideoEncoderImpl for Rav1Enc {
);
}
Err(data::EncoderStatus::Failure) => {
gst_element_error!(element, gst::CoreError::Failed, ["Failed to send frame"]);
gst::element_error!(element, gst::CoreError::Failed, ["Failed to send frame"]);
return Err(gst::FlowError::Error);
}
Err(_) => (),
@ -748,7 +748,7 @@ impl Rav1Enc {
gst_debug!(CAT, obj: element, "Encoded but not output frame yet",);
}
Err(data::EncoderStatus::Failure) => {
gst_element_error!(
gst::element_error!(
element,
gst::CoreError::Failed,
["Failed to receive frame"]

View file

@ -6,8 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use gst::gst_plugin_define;
mod pngenc;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
@ -15,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::plugin_define!(
rspng,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -13,7 +13,7 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_loggable_error};
use gst::{gst_debug, gst_error};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
@ -168,7 +168,7 @@ impl State {
encoder.set_filter(png::FilterType::from(settings.filter));
// Write the header for this video format into our inner buffer
let writer = encoder.write_header().map_err(|e| {
gst_loggable_error!(CAT, "Failed to create encoder error: {}", e.to_string())
gst::loggable_error!(CAT, "Failed to create encoder error: {}", e.to_string())
})?;
self.writer = Some(writer);
Ok(())
@ -319,10 +319,10 @@ impl VideoEncoderImpl for PngEncoder {
let output_state = element
.set_output_state(gst::Caps::new_simple("image/png", &[]), Some(state))
.map_err(|_| gst_loggable_error!(CAT, "Failed to set output state"))?;
.map_err(|_| gst::loggable_error!(CAT, "Failed to set output state"))?;
element
.negotiate(output_state)
.map_err(|_| gst_loggable_error!(CAT, "Failed to negotiate"))
.map_err(|_| gst::loggable_error!(CAT, "Failed to negotiate"))
}
fn handle_frame(
@ -347,7 +347,7 @@ impl VideoEncoderImpl for PngEncoder {
let input_map = input_buffer.map_readable().unwrap();
let data = input_map.as_slice();
state.write_data(data).map_err(|e| {
gst_element_error!(element, gst::CoreError::Failed, [&e.to_string()]);
gst::element_error!(element, gst::CoreError::Failed, [&e.to_string()]);
gst::FlowError::Error
})?;
}