summaryrefslogtreecommitdiff
path: root/voctocore/lib/failvideosrc.py
blob: 500603a447bd3ac7a9f590c911f9e4cc7f41ff22 (plain)
  1. #!/usr/bin/python3
  2. import time, logging
  3. from gi.repository import GLib, Gst
  4. from lib.config import Config
  5. class FailVideoSrc(Gst.Bin):
  6. log = logging.getLogger('FailVideoSrc')
  7. colors = [
  8. 0xffff0000, # red
  9. 0xff00ff00, # green
  10. 0xff0000ff, # blue
  11. 0xffffff00, # yellow
  12. 0xff00ffff, # cyan
  13. 0xffff00ff, # magenta
  14. 0xffffffff, # white
  15. ]
  16. def __init__(self, idx, name):
  17. super().__init__()
  18. # Create elements
  19. self.failsrc = Gst.ElementFactory.make('videotestsrc', None)
  20. # Add elements to Bin
  21. self.add(self.failsrc)
  22. # Set properties
  23. self.failsrc.set_property('foreground-color', self.colors[idx % len(self.colors)])
  24. # Add Ghost Pads
  25. self.add_pad(
  26. Gst.GhostPad.new('src', self.failsrc.get_static_pad('src'))
  27. )