Skip to content

Commit

Permalink
src: stream: sink: Update to the new GStreamer API
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso authored and patrickelectric committed Aug 10, 2023
1 parent 7fa3ace commit b4ad9c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/stream/sink/image_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl ImageSink {
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.buffer().ok_or_else(|| {
let reason = "Failed to get buffer from appsink";
gst::element_error!(appsink, gst::ResourceError::Failed, (reason));
gst::element_error!(appsink, gst::ResourceError::Failed, ("{reason:?}"));

let _ = sender.send(Err(Arc::new(anyhow!(reason))));
pending = false;
Expand Down Expand Up @@ -435,7 +435,7 @@ impl ImageSink {
let frame = gst_video::VideoFrameRef::from_buffer_ref_readable(buffer, &info)
.map_err(|_| {
let reason = "Failed to map buffer readable";
gst::element_error!(appsink, gst::ResourceError::Failed, (reason));
gst::element_error!(appsink, gst::ResourceError::Failed, ("{reason:?}"));

let _ = sender.send(Err(Arc::new(anyhow!(reason))));
pending = false;
Expand Down Expand Up @@ -481,7 +481,9 @@ impl ImageSink {
.build();

// Create the pipeline
let pipeline = gst::Pipeline::new(Some(&format!("pipeline-sink-{sink_id}")));
let pipeline = gst::Pipeline::builder()
.name(format!("pipeline-sink-{sink_id}"))
.build();

// Add Sink elements to the Sink's Pipeline
let mut elements = vec![&_proxysrc];
Expand Down
4 changes: 3 additions & 1 deletion src/stream/sink/udp_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ impl UdpSink {
.context("Failed to get Sink Pad")?;

// Create the pipeline
let pipeline = gst::Pipeline::new(Some(&format!("pipeline-sink-{sink_id}")));
let pipeline = gst::Pipeline::builder()
.name(format!("pipeline-sink-{sink_id}"))
.build();

// Add Sink elements to the Sink's Pipeline
let elements = [&_proxysrc, &_udpsink];
Expand Down

0 comments on commit b4ad9c4

Please sign in to comment.