Skip to content

Commit

Permalink
remove videoflip
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Jul 22, 2024
1 parent df07762 commit 04bf6e9
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,6 @@ fn make_pipewiresrc(fd: RawFd, path: &str) -> Result<gst::Element> {
Ok(src)
}

fn make_videoflip() -> Result<gst::Element> {
let videoflip = gst::ElementFactory::make("videoflip")
.property_from_str("video-direction", "auto")
.build()?;

Ok(videoflip)
}

/// Create a videocrop element that computes the crop from the given coordinates
/// and size.
fn make_videocrop(data: &SelectAreaData) -> Result<gst::Element> {
Expand Down Expand Up @@ -247,15 +239,15 @@ fn make_videocrop(data: &SelectAreaData) -> Result<gst::Element> {
///
/// Single stream:
///
/// pipewiresrc -> videoflip -> videorate
/// pipewiresrc -> videorate
///
/// Multiple streams:
///
/// pipewiresrc1 -> videoflip -> |
/// |
/// pipewiresrc2 -> videoflip -> | -> compositor -> videorate
/// |
/// pipewiresrcn -> videoflip -> |
/// pipewiresrc1 -> |
/// |
/// pipewiresrc2 -> | -> compositor -> videorate
/// |
/// pipewiresrcn -> |
pub fn make_videosrc_bin(
fd: RawFd,
streams: &[Stream],
Expand Down Expand Up @@ -283,9 +275,8 @@ pub fn make_videosrc_bin(
[] => bail!("No streams provided"),
[stream] => {
let pipewiresrc = make_pipewiresrc(fd, &stream.node_id().to_string())?;
let videoflip = make_videoflip()?;
bin.add_many([&pipewiresrc, &videoflip])?;
gst::Element::link_many([&pipewiresrc, &videoflip, &videorate])?;
bin.add(&pipewiresrc)?;
pipewiresrc.link(&videorate)?;
}
streams => {
let compositor = gst::ElementFactory::make("compositor").build()?;
Expand All @@ -295,18 +286,22 @@ pub fn make_videosrc_bin(
let mut last_pos = 0;
for stream in streams {
let pipewiresrc = make_pipewiresrc(fd, &stream.node_id().to_string())?;
let videoflip = make_videoflip()?;
bin.add_many([&pipewiresrc, &videoflip])?;
pipewiresrc.link_filtered(
&videoflip,
&optional_dmabuf_feature_caps(gst::Structure::builder("video/x-raw").build()),
)?;
let pipewiresrc_capsfilter = gst::ElementFactory::make("capsfilter")
.property(
"caps",
&optional_dmabuf_feature_caps(
gst::Structure::builder("video/x-raw").build(),
),
)
.build()?;
bin.add_many([&pipewiresrc, &pipewiresrc_capsfilter])?;
pipewiresrc.link(&pipewiresrc_capsfilter)?;

let compositor_sink_pad = compositor
.request_pad_simple("sink_%u")
.context("Failed to request sink_%u pad from compositor")?;
compositor_sink_pad.set_property("xpos", last_pos);
videoflip
pipewiresrc_capsfilter
.static_pad("src")
.unwrap()
.link(&compositor_sink_pad)?;
Expand Down

0 comments on commit 04bf6e9

Please sign in to comment.