2
1

sample_gst1_python.py 590 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. """A simple test that uses gst1-python to run a fake videotestsrc for 100 frames"""
  3. import sys
  4. import gi
  5. gi.require_version('Gst', '1.0')
  6. from gi.repository import Gst, GLib # noqa: E402
  7. def main():
  8. # Initializes Gstreamer
  9. Gst.init(sys.argv)
  10. pipeline = Gst.parse_launch("videotestsrc num-buffers=100 ! autovideosink")
  11. bus = pipeline.get_bus()
  12. bus.add_signal_watch()
  13. pipeline.set_state(Gst.State.PLAYING)
  14. loop = GLib.MainLoop()
  15. bus.connect("message", on_message, loop)
  16. loop.run()
  17. pipeline.set_state(Gst.State.EOS)
  18. exit(0)