summaryrefslogtreecommitdiff
path: root/voctocore/lib/pipeline.py
blob: 03fdd3d37bbcf2d5349f4d2a2b296716ee521de5 (plain)
  1. #!/usr/bin/python3
  2. import logging
  3. from gi.repository import Gst
  4. # import library components
  5. from lib.config import Config
  6. from lib.avsource import AVSource
  7. from lib.avrawoutput import AVRawOutput
  8. class Pipeline(object):
  9. """mixing, streaming and encoding pipeline constuction and control"""
  10. log = logging.getLogger('Pipeline')
  11. sources = []
  12. mirrors = []
  13. def __init__(self):
  14. self.log.info('Video-Caps configured to: %s', Config.get('mix', 'videocaps'))
  15. self.log.info('Audio-Caps configured to: %s', Config.get('mix', 'audiocaps'))
  16. names = Config.getlist('mix', 'sources')
  17. if len(names) < 1:
  18. raise RuntimeException("At least one AVSource must be configured!")
  19. self.log.info('Creating %u Creating AVSources: %s', len(names), names)
  20. for idx, name in enumerate(names):
  21. port = 10000 + idx
  22. self.log.info('Creating AVSource %s at tcp-port %u', name, port)
  23. source = AVSource(name, port)
  24. self.sources.append(source)
  25. port = 13000 + idx
  26. self.log.info('Creating Mirror-Output for AVSource %s at tcp-port %u', name, port)
  27. mirror = AVRawOutput('%s_mirror' % name, port)
  28. self.mirrors.append(mirror)