Compare commits

..

No commits in common. "sync-time" and "main" have entirely different histories.

3 changed files with 3 additions and 24 deletions

1
Cargo.lock generated
View file

@ -493,7 +493,6 @@ dependencies = [
"gstreamer-gl",
"gstreamer-gl-egl",
"gstreamer-gl-x11",
"gstreamer-net",
"gstreamer-pbutils",
"gstreamer-play",
"gstreamer-player",

View file

@ -43,7 +43,6 @@ winit = { version = "0.29", optional = true, default-features = false, features
atomic_refcell = "0.1"
data-encoding = "2.0"
once_cell = "1"
gst-net = { workspace = true }
[target.'cfg(windows)'.dependencies]
windows = { version = "0.56", features=["Win32_Graphics_Direct3D11",

View file

@ -52,14 +52,7 @@ unsafe impl Send for LayoutWrapper {}
fn create_pipeline() -> Result<gst::Pipeline, Error> {
gst::init()?;
// Create the NTP clock and wait for synchronization.
let clock = gst_net::NtpClock::new(None, "pool.ntp.org", 123, gst::ClockTime::ZERO);
println!("Syncing to NTP clock");
clock.wait_for_sync(gst::ClockTime::from_seconds(5))?;
println!("Synced to NTP clock");
let pipeline = gst::Pipeline::default();
pipeline.set_clock(Some(&clock))?;
// The videotestsrc supports multiple test patterns. In this example, we will use the
// pattern with a white ball moving around the video's center point.
@ -75,29 +68,17 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let caps = gst_video::VideoCapsBuilder::new()
.width(800)
.height(800)
.framerate((15, 1).into())
.build();
let capsfilter = gst::ElementFactory::make("capsfilter")
.property("caps", &caps)
.build()?;
let videoconvert = gst::ElementFactory::make("videoconvert").build()?;
let timestamper = gst::ElementFactory::make("timecodestamper").build()?;
timestamper.set_property_from_str("set", "always");
timestamper.set_property_from_str("source", "rtc");
let timeoverlay = gst::ElementFactory::make("timeoverlay").build()?;
timeoverlay.set_property("font-desc", "Sans Bold 26");
timeoverlay.set_property_from_str("time-mode", "time-code");
timeoverlay.set_property_from_str("halignment", "center");
timeoverlay.set_property_from_str("valignment", "bottom");
timeoverlay.set_property("color", 4200427042u32);
let videoconvert2 = gst::ElementFactory::make("videoconvert").build()?;
let sink = gst::ElementFactory::make("autovideosink").build()?;
pipeline.add_many([&src, &overlay, &capsfilter, &videoconvert, &timestamper, &timeoverlay, &videoconvert2, &sink])?;
gst::Element::link_many([&src, &overlay, &capsfilter, &videoconvert, &timestamper, &timeoverlay, &videoconvert2, &sink])?;
pipeline.add_many([&src, &overlay, &capsfilter, &videoconvert, &sink])?;
gst::Element::link_many([&src, &overlay, &capsfilter, &videoconvert, &sink])?;
// The PangoFontMap represents the set of fonts available for a particular rendering system.
let fontmap = pangocairo::FontMap::new();