livesync: add support for image formats

The livesync element is also useful for Motion JPEG streams. However,
Motion JPEG uses image/ caps instead of video/ caps.

The framerate is defined for image/, too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1440>
This commit is contained in:
Michael Tretter 2024-01-24 12:51:57 +01:00 committed by GStreamer Marge Bot
parent 54f24fe4b0
commit 4bb867bf52

View file

@ -38,7 +38,7 @@ fn audio_info_from_caps(
fn duration_from_caps(caps: &gst::CapsRef) -> Option<gst::ClockTime> { fn duration_from_caps(caps: &gst::CapsRef) -> Option<gst::ClockTime> {
caps.structure(0) caps.structure(0)
.filter(|s| s.name().starts_with("video/")) .filter(|s| s.name().starts_with("video/") || s.name().starts_with("image/"))
.and_then(|s| s.get::<gst::Fraction>("framerate").ok()) .and_then(|s| s.get::<gst::Fraction>("framerate").ok())
.filter(|framerate| framerate.denom() > 0 && framerate.numer() > 0) .filter(|framerate| framerate.denom() > 0 && framerate.numer() > 0)
.and_then(|framerate| { .and_then(|framerate| {