mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 05:21:00 +00:00
Update for new BaseTransformImpl::set_caps() return type
This commit is contained in:
parent
7ba1e6f60d
commit
9f75a1cecc
5 changed files with 27 additions and 12 deletions
|
@ -13,6 +13,7 @@ gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
|
||||||
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||||
byte-slice-cast = "0.3"
|
byte-slice-cast = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
|
lazy_static = "1.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "gstrsaudiofx"
|
name = "gstrsaudiofx"
|
||||||
|
|
|
@ -24,6 +24,14 @@ use byte_slice_cast::*;
|
||||||
use num_traits::cast::{FromPrimitive, ToPrimitive};
|
use num_traits::cast::{FromPrimitive, ToPrimitive};
|
||||||
use num_traits::float::Float;
|
use num_traits::float::Float;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
|
||||||
|
"rsaudioecho",
|
||||||
|
gst::DebugColorFlags::empty(),
|
||||||
|
Some("Rust Audio Echo Filter"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_MAX_DELAY: u64 = gst::SECOND_VAL;
|
const DEFAULT_MAX_DELAY: u64 = gst::SECOND_VAL;
|
||||||
const DEFAULT_DELAY: u64 = 500 * gst::MSECOND_VAL;
|
const DEFAULT_DELAY: u64 = 500 * gst::MSECOND_VAL;
|
||||||
const DEFAULT_INTENSITY: f64 = 0.5;
|
const DEFAULT_INTENSITY: f64 = 0.5;
|
||||||
|
@ -279,13 +287,16 @@ impl BaseTransformImpl for AudioEcho {
|
||||||
_element: &gst_base::BaseTransform,
|
_element: &gst_base::BaseTransform,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> bool {
|
) -> Result<(), gst::LoggableError> {
|
||||||
if incaps != outcaps {
|
if incaps != outcaps {
|
||||||
return false;
|
return Err(gst_loggable_error!(
|
||||||
|
CAT,
|
||||||
|
"Input and output caps are not the same"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let info = match gst_audio::AudioInfo::from_caps(incaps) {
|
let info = match gst_audio::AudioInfo::from_caps(incaps) {
|
||||||
None => return false,
|
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
|
||||||
Some(info) => info,
|
Some(info) => info,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -298,7 +309,7 @@ impl BaseTransformImpl for AudioEcho {
|
||||||
buffer: RingBuffer::new(buffer_size as usize),
|
buffer: RingBuffer::new(buffer_size as usize),
|
||||||
});
|
});
|
||||||
|
|
||||||
true
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, _element: &gst_base::BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, _element: &gst_base::BaseTransform) -> Result<(), gst::ErrorMessage> {
|
||||||
|
|
|
@ -17,6 +17,9 @@ extern crate gstreamer_audio as gst_audio;
|
||||||
extern crate gstreamer_base as gst_base;
|
extern crate gstreamer_base as gst_base;
|
||||||
extern crate num_traits;
|
extern crate num_traits;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate lazy_static;
|
||||||
|
|
||||||
mod audioecho;
|
mod audioecho;
|
||||||
|
|
||||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||||
|
|
|
@ -380,13 +380,13 @@ impl BaseTransformImpl for Rgb2Gray {
|
||||||
element: &gst_base::BaseTransform,
|
element: &gst_base::BaseTransform,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> bool {
|
) -> Result<(), gst::LoggableError> {
|
||||||
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
|
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
|
||||||
None => return false,
|
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
|
||||||
Some(info) => info,
|
Some(info) => info,
|
||||||
};
|
};
|
||||||
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
|
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
|
||||||
None => return false,
|
None => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
|
||||||
Some(info) => info,
|
Some(info) => info,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ impl BaseTransformImpl for Rgb2Gray {
|
||||||
|
|
||||||
*self.state.lock().unwrap() = Some(State { in_info, out_info });
|
*self.state.lock().unwrap() = Some(State { in_info, out_info });
|
||||||
|
|
||||||
true
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when shutting down the element so we can release all stream-related state
|
// Called when shutting down the element so we can release all stream-related state
|
||||||
|
|
|
@ -419,13 +419,13 @@ impl BaseTransformImpl for Rgb2Gray {
|
||||||
element: &gst_base::BaseTransform,
|
element: &gst_base::BaseTransform,
|
||||||
incaps: &gst::Caps,
|
incaps: &gst::Caps,
|
||||||
outcaps: &gst::Caps,
|
outcaps: &gst::Caps,
|
||||||
) -> bool {
|
) -> Result<(), gst::LoggableError> {
|
||||||
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
|
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
|
||||||
None => return false,
|
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
|
||||||
Some(info) => info,
|
Some(info) => info,
|
||||||
};
|
};
|
||||||
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
|
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
|
||||||
None => return false,
|
None => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
|
||||||
Some(info) => info,
|
Some(info) => info,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ impl BaseTransformImpl for Rgb2Gray {
|
||||||
|
|
||||||
*self.state.lock().unwrap() = Some(State { in_info, out_info });
|
*self.state.lock().unwrap() = Some(State { in_info, out_info });
|
||||||
|
|
||||||
true
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self, element: &gst_base::BaseTransform) -> Result<(), gst::ErrorMessage> {
|
fn stop(&self, element: &gst_base::BaseTransform) -> Result<(), gst::ErrorMessage> {
|
||||||
|
|
Loading…
Reference in a new issue