Created
December 21, 2020 02:09
-
-
Save WuChanGG/18da3beb59c4a65c9ab4f854dc73b417 to your computer and use it in GitHub Desktop.
Trying to set the render rectangle of the video sink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let video_sink = gstreamer::ElementFactory::make("d3d11videosink", None).unwrap_or_else(|err| { | |
println!("{:?}", err); | |
panic!(); | |
}); | |
let video_sink_cast = video_sink.clone().dynamic_cast::<gstreamer_video::VideoOverlay>().unwrap(); | |
unsafe { | |
let rwh = display.gl_window().window().raw_window_handle(); | |
let hwnd = match rwh { | |
raw_window_handle::RawWindowHandle::Windows(windows_handle) => Some(windows_handle.hwnd), | |
_ => None | |
}; | |
video_sink_cast.set_window_handle(hwnd.unwrap() as usize); | |
} | |
video_sink_cast.set_property("fullscreen", &false).unwrap(); | |
video_sink_cast.set_render_rectangle(0, 0, 200, 200).unwrap_or_else(|err| { | |
println!("{:?}", err); | |
panic!(); | |
}); | |
video_sink_cast.expose(); | |
playbin.set_property("video-sink", &video_sink).unwrap_or_else(|err| { | |
println!("{:?}", err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment