mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-08 18:25:30 +00:00
Fix compilation after gstreamer-rs!383
This commit is contained in:
parent
ef8adbf113
commit
ccfb8246be
20 changed files with 39 additions and 35 deletions
|
@ -265,7 +265,7 @@ impl BaseTransformImpl for AudioEcho {
|
|||
let mut state_guard = self.state.lock().unwrap();
|
||||
let state = state_guard.as_mut().ok_or(gst::FlowError::NotNegotiated)?;
|
||||
|
||||
let mut map = buf.map_writable().ok_or(gst::FlowError::Error)?;
|
||||
let mut map = buf.map_writable().map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
match state.info.format() {
|
||||
gst_audio::AUDIO_FORMAT_F64 => {
|
||||
|
|
|
@ -123,7 +123,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
|
||||
let cmd = {
|
||||
let input = frame.get_input_buffer().unwrap();
|
||||
let map = input.map_readable().ok_or_else(|| {
|
||||
let map = input.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
@ -155,7 +155,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
|
||||
let mut out_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_writable(output, info.as_ref().unwrap())
|
||||
.ok_or_else(|| {
|
||||
.map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
|
|
@ -152,7 +152,7 @@ impl BaseParseImpl for CdgParse {
|
|||
// Scan for CDG instruction
|
||||
let input = frame.get_buffer().unwrap();
|
||||
let skip = {
|
||||
let map = input.map_readable().ok_or_else(|| {
|
||||
let map = input.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
@ -176,7 +176,7 @@ impl BaseParseImpl for CdgParse {
|
|||
}
|
||||
|
||||
let (keyframe, header) = {
|
||||
let map = input.map_readable().ok_or_else(|| {
|
||||
let map = input.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
|
|
@ -65,9 +65,9 @@ fn test_cdgdec() {
|
|||
// Add a handler to the "new-sample" signal.
|
||||
.new_sample(move |appsink| {
|
||||
// Pull the sample in question out of the appsink's buffer.
|
||||
let sample = appsink.pull_sample().ok_or(gst::FlowError::Eos)?;
|
||||
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
|
||||
let buffer = sample.get_buffer().ok_or(gst::FlowError::Error)?;
|
||||
let map = buffer.map_readable().ok_or(gst::FlowError::Error)?;
|
||||
let map = buffer.map_readable().map_err(|_| gst::FlowError::Error)?;
|
||||
|
||||
// First frame fully blue
|
||||
map.as_slice()
|
||||
|
|
|
@ -345,7 +345,7 @@ impl MccEnc {
|
|||
|
||||
let _ = write!(outbuf, "{}\t", meta.get_tc());
|
||||
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
|
|
|
@ -158,7 +158,7 @@ impl State {
|
|||
|
||||
let first_buf = self.internal_buffer.first().unwrap();
|
||||
for buffer in self.internal_buffer.iter() {
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
|
|
|
@ -148,7 +148,7 @@ fn test_pull() {
|
|||
while h.events_in_queue() != 0 {
|
||||
let event = h.pull_event();
|
||||
|
||||
if let Some(event) = event {
|
||||
if let Ok(event) = event {
|
||||
match event.view() {
|
||||
EventView::Eos(_) => {
|
||||
done = true;
|
||||
|
@ -185,7 +185,7 @@ fn test_pull() {
|
|||
let mut done = false;
|
||||
|
||||
while h.buffers_in_queue() != 0 {
|
||||
if let Some(buffer) = h.pull() {
|
||||
if let Ok(buffer) = h.pull() {
|
||||
let pts = buffer.get_pts();
|
||||
assert!(pts > gst::SECOND && pts < 2 * gst::SECOND);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ fn test_pull() {
|
|||
while h.events_in_queue() != 0 {
|
||||
let event = h.pull_event();
|
||||
|
||||
if let Some(event) = event {
|
||||
if let Ok(event) = event {
|
||||
match event.view() {
|
||||
EventView::Eos(_) => {
|
||||
done = true;
|
||||
|
|
|
@ -204,7 +204,8 @@ fn create_ui(app: >k::Application) {
|
|||
};
|
||||
|
||||
glib::Continue(true)
|
||||
});
|
||||
})
|
||||
.expect("Failed to add bus watch");
|
||||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ impl BaseSinkImpl for FileSink {
|
|||
};
|
||||
|
||||
gst_trace!(CAT, obj: element, "Rendering {:?}", buffer);
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst_element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
|
|
@ -325,7 +325,7 @@ impl BaseSrcImpl for FileSrc {
|
|||
}
|
||||
|
||||
let size = {
|
||||
let mut map = buffer.map_writable().ok_or_else(|| {
|
||||
let mut map = buffer.map_writable().map_err(|_| {
|
||||
gst_element_error!(element, gst::LibraryError::Failed, ["Failed to map buffer"]);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
|
|
@ -186,7 +186,7 @@ impl AudioDecoderImpl for LewtonDec {
|
|||
Some(inbuf) => inbuf,
|
||||
};
|
||||
|
||||
let inmap = inbuf.map_readable().ok_or_else(|| {
|
||||
let inmap = inbuf.map_readable().map_err(|_| {
|
||||
gst_error!(CAT, obj: element, "Failed to buffer readable");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
@ -277,7 +277,7 @@ impl LewtonDec {
|
|||
};
|
||||
|
||||
// First try to parse the headers
|
||||
let ident_map = ident_buf.map_readable().ok_or_else(|| {
|
||||
let ident_map = ident_buf.map_readable().map_err(|_| {
|
||||
gst_error!(CAT, obj: element, "Failed to map ident buffer readable");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
@ -290,7 +290,7 @@ impl LewtonDec {
|
|||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
let comment_map = comment_buf.map_readable().ok_or_else(|| {
|
||||
let comment_map = comment_buf.map_readable().map_err(|_| {
|
||||
gst_error!(CAT, obj: element, "Failed to map comment buffer readable");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
@ -303,7 +303,7 @@ impl LewtonDec {
|
|||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
let setup_map = setup_buf.map_readable().ok_or_else(|| {
|
||||
let setup_map = setup_buf.map_readable().map_err(|_| {
|
||||
gst_error!(CAT, obj: element, "Failed to map setup buffer readable");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
@ -420,7 +420,7 @@ impl LewtonDec {
|
|||
|
||||
let mut outbuf = element
|
||||
.allocate_output_buffer(sample_count as usize * audio_info.bpf() as usize)
|
||||
.ok_or_else(|| {
|
||||
.map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::StreamError::Decode,
|
||||
|
@ -433,7 +433,7 @@ impl LewtonDec {
|
|||
// while reordering the channels to the GStreamer channel order
|
||||
{
|
||||
let outbuf = outbuf.get_mut().unwrap();
|
||||
let mut outmap = outbuf.map_writable().ok_or_else(|| {
|
||||
let mut outmap = outbuf.map_writable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::StreamError::Decode,
|
||||
|
|
|
@ -692,7 +692,7 @@ impl VideoEncoderImpl for Rav1Enc {
|
|||
|
||||
let in_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_readable(&*input_buffer, &state.video_info)
|
||||
.ok_or_else(|| {
|
||||
.map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
|
|
@ -507,7 +507,7 @@ impl BaseSinkImpl for S3Sink {
|
|||
}
|
||||
|
||||
gst_trace!(CAT, obj: element, "Rendering {:?}", buffer);
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst_element_error!(element, gst::CoreError::Failed, ["Failed to map buffer"]);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
|
|
@ -128,7 +128,7 @@ impl State {
|
|||
buffer: &gst::Buffer,
|
||||
chunk_index: u64,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
|
@ -406,7 +406,7 @@ impl Decrypter {
|
|||
return Err(err);
|
||||
}
|
||||
|
||||
let map = buffer.map_readable().ok_or_else(|| {
|
||||
let map = buffer.map_readable().map_err(|_| {
|
||||
let err = gst_loggable_error!(CAT, "Failed to map buffer readable");
|
||||
err.log_with_object(element);
|
||||
err
|
||||
|
|
|
@ -109,7 +109,7 @@ fn test_pipeline() {
|
|||
// Add a handler to the "new-sample" signal.
|
||||
.new_sample(move |appsink| {
|
||||
// Pull the sample in question out of the appsink's buffer.
|
||||
let sample = appsink.pull_sample().ok_or(gst::FlowError::Eos)?;
|
||||
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
|
||||
let buffer = sample.get_buffer().ok_or(gst::FlowError::Error)?;
|
||||
|
||||
let mut adapter = adapter_clone.lock().unwrap();
|
||||
|
|
|
@ -94,7 +94,7 @@ fn encrypt_file() {
|
|||
h.push_event(gst::Event::new_eos().build());
|
||||
|
||||
println!("Pulling buffer...");
|
||||
while let Some(buf) = h.pull() {
|
||||
while let Ok(buf) = h.pull() {
|
||||
adapter.push(buf);
|
||||
if adapter.available() >= expected_output.len() {
|
||||
break;
|
||||
|
|
|
@ -162,7 +162,8 @@ fn main() {
|
|||
};
|
||||
|
||||
glib::Continue(true)
|
||||
});
|
||||
})
|
||||
.expect("Failed to add bus watch");
|
||||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ fn create_pipeline() -> (
|
|||
let video_convert2 = gst::ElementFactory::make("videoconvert", None).unwrap();
|
||||
|
||||
let (video_sink, video_widget) =
|
||||
if let Some(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) {
|
||||
if let Ok(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) {
|
||||
let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap();
|
||||
glsinkbin.set_property("sink", >kglsink).unwrap();
|
||||
|
||||
|
@ -325,7 +325,8 @@ fn create_ui(app: >k::Application) {
|
|||
};
|
||||
|
||||
glib::Continue(true)
|
||||
});
|
||||
})
|
||||
.expect("Failed to add bus watch");
|
||||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ fn recv_buffers(
|
|||
#[test]
|
||||
fn test_create() {
|
||||
init();
|
||||
assert!(gst::ElementFactory::make("togglerecord", None).is_some());
|
||||
assert!(gst::ElementFactory::make("togglerecord", None).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -445,7 +445,7 @@ impl BaseTransformImpl for Rgb2Gray {
|
|||
// info that is passed here
|
||||
let in_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_readable(inbuf.as_ref(), &state.in_info)
|
||||
.ok_or_else(|| {
|
||||
.map_err(|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
|
@ -456,15 +456,16 @@ impl BaseTransformImpl for Rgb2Gray {
|
|||
|
||||
// And now map the output buffer writable, so we can fill it.
|
||||
let mut out_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_writable(outbuf, &state.out_info)
|
||||
.ok_or_else(|| {
|
||||
gst_video::VideoFrameRef::from_buffer_ref_writable(outbuf, &state.out_info).map_err(
|
||||
|_| {
|
||||
gst_element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
["Failed to map output buffer writable"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
},
|
||||
)?;
|
||||
|
||||
// Keep the various metadata we need for working with the video frames in
|
||||
// local variables. This saves some typing below.
|
||||
|
|
Loading…
Reference in a new issue