summaryrefslogtreecommitdiff
path: root/voctocore/lib/pipeline.py
blob: 3aa8085ba4f9ecd2e5d850202adb375a782ff914 (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. from lib.videomix import VideoMix
  9. from lib.audiomix import AudioMix
  10. class Pipeline(object):
  11. """mixing, streaming and encoding pipeline constuction and control"""
  12. log = logging.getLogger('Pipeline')
  13. sources = []
  14. outputs = []
  15. vmix = None
  16. amix = None
  17. def __init__(self):
  18. self.log.info('Video-Caps configured to: %s', Config.get('mix', 'videocaps'))
  19. self.log.info('Audio-Caps configured to: %s', Config.get('mix', 'audiocaps'))
  20. names = Config.getlist('mix', 'sources')
  21. if len(names) < 1:
  22. raise RuntimeException("At least one AVSource must be configured!")
  23. self.log.info('Creating %u Creating AVSources: %s', len(names), names)
  24. for idx, name in enumerate(names):
  25. port = 10000 + idx
  26. self.log.info('Creating AVSource %s at tcp-port %u', name, port)
  27. source = AVSource(name, port)
  28. self.sources.append(source)
  29. port = 13000 + idx
  30. self.log.info('Creating Mirror-Output for AVSource %s at tcp-port %u', name, port)
  31. mirror = AVRawOutput('%s_mirror' % name, port)
  32. self.outputs.append(mirror)
  33. self.log.info('Creating Videmixer')
  34. self.vmix = VideoMix()
  35. self.log.info('Creating Videmixer')
  36. self.amix = AudioMix()
  37. port = 11000
  38. self.log.info('Creating Mixer-Output at tcp-port %u', port)
  39. output = AVRawOutput('mix', port)
  40. self.outputs.append(output)