Skip to content

Commit

Permalink
misc: use plain videoconvert for sink
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Dec 4, 2023
1 parent 433773e commit f65f921
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use gtk::{
use crate::{
audio_device::{self, Class as AudioDeviceClass},
screencast_session::Stream,
utils,
};

const DURATION_UPDATE_INTERVAL: Duration = Duration::from_millis(200);
Expand Down Expand Up @@ -677,26 +676,16 @@ impl Pipeline {
let compositor = gst::ElementFactory::make("compositor")
.name(COMPOSITOR_NAME)
.build()?;
let convert = gst::ElementFactory::make("videoconvert")
.property("chroma-mode", gst_video::VideoChromaMode::None)
.property("dither", gst_video::VideoDitherMethod::None)
.property("matrix-mode", gst_video::VideoMatrixMode::OutputOnly)
.property("n-threads", utils::ideal_thread_count())
.build()?;
let tee = gst::ElementFactory::make("tee")
.name(VIDEO_TEE_NAME)
.build()?;
let convert = gst::ElementFactory::make("videoconvert").build()?;
let sink = gst::ElementFactory::make("gtk4paintablesink")
.name(PAINTABLE_SINK_NAME)
.build()?;

imp.inner.add_many([&compositor, &convert, &tee, &sink])?;
gst::Element::link_many([&compositor, &convert, &tee])?;

let tee_src_pad = tee
.request_pad_simple("src_%u")
.context("Failed to request sink_%u pad from compositor")?;
tee_src_pad.link(&sink.static_pad("sink").unwrap())?;
imp.inner.add_many([&compositor, &tee, &convert, &sink])?;
gst::Element::link_many([&compositor, &tee, &convert, &sink])?;

let bus_watch_guard = imp.inner.bus().unwrap().add_watch_local(
clone!(@weak self as obj => @default-panic, move |_, message| {
Expand Down

0 comments on commit f65f921

Please sign in to comment.