From da300d3aa0cb53df193e0c3df8f8acb9e9c416ab Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Tue, 28 May 2019 21:48:53 +0200 Subject: [PATCH] we need a way to terminate --- ffplayout.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ffplayout.py b/ffplayout.py index 93906e1c..25bb24d9 100755 --- a/ffplayout.py +++ b/ffplayout.py @@ -272,7 +272,7 @@ def is_int(value): # compare clip play time with real time, # to see if we are sync -def check_sync(begin): +def check_sync(begin, playout): time_now = get_time('full_sec') # around 2.5 seconds is in ffmpeg buffer @@ -293,6 +293,7 @@ def check_sync(begin): if _general.stop and abs(time_distance) > _general.threshold: logger.error('Sync tolerance value exceeded, program terminated!') + playout.terminate() sys.exit(1) @@ -585,8 +586,9 @@ def build_filtergraph(first, duration, seek, out, ad, ad_last, ad_next, dummy): # ------------------------------------------------------------------------------ # read values from json playlist -class GetSourceIter: - def __init__(self): +class GetSourceIter(object): + def __init__(self, playout): + self._playout = playout self.last_time = get_time('full_sec') if 0 <= self.last_time < _playlist.start: @@ -826,7 +828,7 @@ class GetSourceIter: self.last = False if self.has_begin: - check_sync(self.begin) + check_sync(self.begin, self._playout) self.map_extension(node) self.url_or_live_source() @@ -873,7 +875,6 @@ class GetSourceIter: def main(): - get_source = GetSourceIter() year = get_date(False).split('-')[0] if _pre_comp.copy: @@ -923,6 +924,8 @@ def main(): stdin=PIPE ) + get_source = GetSourceIter(playout) + for src_cmd, filtergraph in get_source.next(): if src_cmd[0] == '-i': current_file = src_cmd[1]