Loading

Paste #pw1vudabr

  1. import time
  2. import gi
  3. gi.require_version('Gst', '1.0')
  4. from gi.repository import Gst
  5.  
  6.  
  7. def change_state(pipeline, state):
  8.     pipeline.set_state(state)
  9.     if pipeline.get_state(Gst.CLOCK_TIME_NONE)[0] != Gst.StateChangeReturn.SUCCESS:
  10.         print("Failed!")
  11.  
  12.  
  13. Gst.init(())
  14.  
  15. p = Gst.parse_launch("nvarguscamerasrc ! fakesink")
  16.  
  17. change_state(p, Gst.State.PLAYING)
  18. time.sleep(1)
  19. change_state(p, Gst.State.NULL)
  20. time.sleep(1)
  21. change_state(p, Gst.State.PLAYING)