Skip to content

Commit

Permalink
fix: add videoconvert before videoflip
Browse files Browse the repository at this point in the history
videoflip doesn't support dmabuf
  • Loading branch information
SeaDve committed Jul 22, 2024
1 parent ef6a510 commit 05e2da7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ fn make_videocrop(data: &SelectAreaData) -> Result<gst::Element> {
///
/// Single stream:
///
/// pipewiresrc -> videoflip -> videorate
/// pipewiresrc -> videoconvert -> videoflip -> videorate
///
/// Multiple streams:
///
/// pipewiresrc1 -> videoflip -> |
/// |
/// pipewiresrc2 -> videoflip -> | -> compositor -> videorate
/// |
/// pipewiresrcn -> videoflip -> |
/// pipewiresrc1 -> videoconvert -> videoflip -> |
/// |
/// pipewiresrc2 -> videoconvert -> videoflip -> | -> compositor -> videorate
/// |
/// pipewiresrcn -> videoconvert -> videoflip -> |
pub fn make_videosrc_bin(
fd: RawFd,
streams: &[Stream],
Expand Down Expand Up @@ -283,9 +283,10 @@ pub fn make_videosrc_bin(
[] => bail!("No streams provided"),
[stream] => {
let pipewiresrc = make_pipewiresrc(fd, &stream.node_id().to_string())?;
let videoconvert = gst::ElementFactory::make("videoconvert").build()?;
let videoflip = make_videoflip()?;
bin.add_many([&pipewiresrc, &videoflip])?;
gst::Element::link_many([&pipewiresrc, &videoflip, &videorate])?;
bin.add_many([&pipewiresrc, &videoconvert, &videoflip])?;
gst::Element::link_many([&pipewiresrc, &videoconvert, &videoflip, &videorate])?;
}
streams => {
let compositor = gst::ElementFactory::make("compositor").build()?;
Expand All @@ -295,12 +296,14 @@ 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 videoconvert = gst::ElementFactory::make("videoconvert").build()?;
let videoflip = make_videoflip()?;
bin.add_many([&pipewiresrc, &videoflip])?;
bin.add_many([&pipewiresrc, &videoconvert, &videoflip])?;
pipewiresrc.link_filtered(
&videoflip,
&videoconvert,
&optional_dmabuf_feature_caps(gst::Structure::builder("video/x-raw").build()),
)?;
videoconvert.link(&videoflip)?;

let compositor_sink_pad = compositor
.request_pad_simple("sink_%u")
Expand Down

0 comments on commit 05e2da7

Please sign in to comment.