Skip to content

Commit

Permalink
Fully disable StreamBlanker when stream-blanker.enabled=false. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Florob committed Mar 15, 2017
1 parent 50b8077 commit d90b03a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
55 changes: 29 additions & 26 deletions voctocore/lib/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def __init__(self, pipeline):
self.pipeline = pipeline

self.sources = Config.getlist('mix', 'sources')
self.blankerSources = Config.getlist('stream-blanker', 'sources')
if Config.getboolean('stream-blanker', 'enabled'):
self.blankerSources = Config.getlist('stream-blanker', 'sources')

# Commands are defined below. Errors are sent to the clients by throwing
# exceptions, they will be turned into messages outside.
Expand Down Expand Up @@ -105,10 +106,11 @@ def help(self):
for source in self.sources:
helplines.append("\t" + source)

helplines.append("\n")
helplines.append("Stream-Blanker Sources-Names:")
for source in self.blankerSources:
helplines.append("\t" + source)
if Config.getboolean('stream-blanker', 'enabled'):
helplines.append("\n")
helplines.append("Stream-Blanker Sources-Names:")
for source in self.blankerSources:
helplines.append("\t" + source)

helplines.append("\n")
helplines.append("Composition-Modes:")
Expand Down Expand Up @@ -210,33 +212,34 @@ def set_videos_and_composite(self, src_a_name_or_id, src_b_name_or_id,
NotifyResponse('video_status', *video_status)
]

def _get_stream_status(self):
blankSource = self.pipeline.streamblanker.blankSource
if blankSource is None:
return ('live',)
if Config.getboolean('stream-blanker', 'enabled'):
def _get_stream_status(self):
blankSource = self.pipeline.streamblanker.blankSource
if blankSource is None:
return ('live',)

return 'blank', encodeName(self.blankerSources, blankSource)
return 'blank', encodeName(self.blankerSources, blankSource)

def get_stream_status(self):
"""gets the current streamblanker-status"""
status = self._get_stream_status()
return OkResponse('stream_status', *status)
def get_stream_status(self):
"""gets the current streamblanker-status"""
status = self._get_stream_status()
return OkResponse('stream_status', *status)

def set_stream_blank(self, source_name_or_id):
"""sets the streamblanker-status to blank with the specified
blanker-source-name or -id"""
src_id = decodeName(self.blankerSources, source_name_or_id)
self.pipeline.streamblanker.setBlankSource(src_id)
def set_stream_blank(self, source_name_or_id):
"""sets the streamblanker-status to blank with the specified
blanker-source-name or -id"""
src_id = decodeName(self.blankerSources, source_name_or_id)
self.pipeline.streamblanker.setBlankSource(src_id)

status = self._get_stream_status()
return NotifyResponse('stream_status', *status)
status = self._get_stream_status()
return NotifyResponse('stream_status', *status)

def set_stream_live(self):
"""sets the streamblanker-status to live"""
self.pipeline.streamblanker.setBlankSource(None)
def set_stream_live(self):
"""sets the streamblanker-status to live"""
self.pipeline.streamblanker.setBlankSource(None)

status = self._get_stream_status()
return NotifyResponse('stream_status', *status)
status = self._get_stream_status()
return NotifyResponse('stream_status', *status)

def get_config(self):
"""returns the parsed server-config"""
Expand Down
10 changes: 5 additions & 5 deletions voctocore/lib/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def __init__(self):
source = AVSource('streamblanker', port, has_video=False)
self.sbsources.append(source)

self.log.info('Creating StreamBlanker')
self.streamblanker = StreamBlanker()
self.log.info('Creating StreamBlanker')
self.streamblanker = StreamBlanker()

port = 15000
self.log.info('Creating StreamBlanker-Output at tcp-port %u', port)
self.streamout = AVRawOutput('streamblanker_out', port)
port = 15000
self.log.info('Creating StreamBlanker-Output at tcp-port %u', port)
self.streamout = AVRawOutput('streamblanker_out', port)

0 comments on commit d90b03a

Please sign in to comment.