Skip to main content

Module gstreamer_pipe

Module gstreamer_pipe 

Source
Expand description

Real video decode via the gst-launch-1.0 and gst-discoverer-1.0 CLIs.

Mirrors the spirit of crate::mock::MockVideoStream but reads bytes from a real GStreamer pipeline:

filesrc location=<path>
  ! decodebin
  ! videoconvert
  ! video/x-raw,format=BGRA
  ! fdsink fd=1

§Trade-offs

  • + Zero compile-time integration with libgstreamer; works against any system GStreamer the user installs (brew install gstreamer, apt install gstreamer1.0-tools, …). No FFI surface.
  • + GStreamer is LGPL — friendlier than FFmpeg’s GPL-or-LGPL split, no licensing entanglement for our binary either way.
  • + Hardware decode picks up automatically when GStreamer’s vah264dec / vtdec / nvh264dec plugins are present.
  • Per-process fork; for the player loop that’s one fork for the whole stream, not per-frame.
  • Assumes gst-launch-1.0 and gst-discoverer-1.0 on PATH. Reported as Error::Spawn rather than a panic.

For a proper Rust-bound integration via gstreamer-rs see M-DEC.3+; the crate::VideoStream trait makes it a swap-in replacement.

Structs§

GstreamerPipeStream
Streams BGRA frames from a video file by piping it through gst-launch-1.0.
VideoMetadata
Per-stream metadata, as reported by gst-discoverer-1.0.

Enums§

Error
Failure modes for the gstreamer-pipe decoder.

Functions§

file_uri 🔒
gstreamer_available
Whether both gst-launch-1.0 and gst-discoverer-1.0 are on PATH and runnable. Useful as a runtime guard for tests + production code that wants to gracefully degrade when GStreamer isn’t installed.
parse_clock 🔒
Parses gst-discoverer-1.0 Duration: clocks like 0:00:00.266666666.
parse_discoverer 🔒
Parse gst-discoverer-1.0 -v output for the first video stream.
parse_rational 🔒
Parses gst-discoverer-1.0 rationals like 30/1 or 30000/1001.

Type Aliases§

Result
Convenience alias.