pass program node to custom filters, for using custom properties.
This commit is contained in:
parent
de5e56473c
commit
1274d8b288
@ -249,14 +249,14 @@ def split_filter(filter_type):
|
||||
return _filter
|
||||
|
||||
|
||||
def custom_filter(probe, type):
|
||||
def custom_filter(probe, type, node):
|
||||
filter_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
filters = []
|
||||
|
||||
for filter in glob(os.path.join(filter_dir, f'{type}_*')):
|
||||
filter = os.path.splitext(os.path.basename(filter))[0]
|
||||
filter_func = locate(f'ffplayout.filters.{filter}.filter')
|
||||
link = filter_func(probe)
|
||||
link = filter_func(probe, node)
|
||||
|
||||
if link is not None:
|
||||
filters.append(link)
|
||||
@ -264,7 +264,8 @@ def custom_filter(probe, type):
|
||||
return filters
|
||||
|
||||
|
||||
def build_filtergraph(duration, seek, out, ad, ad_last, ad_next, probe, msg):
|
||||
def build_filtergraph(node, duration, seek, out,
|
||||
ad, ad_last, ad_next, probe, msg):
|
||||
"""
|
||||
build final filter graph, with video and audio chain
|
||||
"""
|
||||
@ -275,7 +276,7 @@ def build_filtergraph(duration, seek, out, ad, ad_last, ad_next, probe, msg):
|
||||
seek = 0
|
||||
|
||||
if probe.video[0]:
|
||||
custom_v_filter = custom_filter(probe, 'v')
|
||||
custom_v_filter = custom_filter(probe, 'v', node)
|
||||
video_chain += text_filter()
|
||||
video_chain += deinterlace_filter(probe)
|
||||
video_chain += pad_filter(probe)
|
||||
@ -289,7 +290,7 @@ def build_filtergraph(duration, seek, out, ad, ad_last, ad_next, probe, msg):
|
||||
audio_chain += add_audio(probe, out - seek, msg)
|
||||
|
||||
if not audio_chain:
|
||||
custom_a_filter = custom_filter(probe, 'a')
|
||||
custom_a_filter = custom_filter(probe, 'a', node)
|
||||
|
||||
audio_chain.append('[0:a]anull')
|
||||
audio_chain += add_loudnorm(probe)
|
||||
|
@ -4,7 +4,7 @@ import re
|
||||
from ffplayout.utils import _text
|
||||
|
||||
|
||||
def filter(probe):
|
||||
def filter(probe, node=None):
|
||||
"""
|
||||
extract title from file name and overlay it
|
||||
"""
|
||||
|
@ -58,6 +58,7 @@ class GetSourceFromPlaylist:
|
||||
self.last = False
|
||||
self.list_date = get_date(True)
|
||||
|
||||
self.node = None
|
||||
self.src = None
|
||||
self.begin = 0
|
||||
self.seek = 0
|
||||
@ -160,8 +161,8 @@ class GetSourceFromPlaylist:
|
||||
|
||||
def set_filtergraph(self):
|
||||
self.filtergraph = build_filtergraph(
|
||||
self.duration, self.seek, self.out, self.ad, self.ad_last,
|
||||
self.ad_next, self.probe, messenger)
|
||||
self.node, self.duration, self.seek, self.out,
|
||||
self.ad, self.ad_last, self.ad_next, self.probe, messenger)
|
||||
|
||||
def check_for_next_playlist(self):
|
||||
if not self.next_playlist:
|
||||
@ -230,14 +231,14 @@ class GetSourceFromPlaylist:
|
||||
self.begin = self.init_time
|
||||
|
||||
# loop through all clips in playlist and get correct clip in time
|
||||
for index, node in enumerate(self.clip_nodes["program"]):
|
||||
self.get_clip_in_out(node)
|
||||
for index, self.node in enumerate(self.clip_nodes["program"]):
|
||||
self.get_clip_in_out(self.node)
|
||||
|
||||
# first time we end up here
|
||||
if self.first and \
|
||||
self.last_time < self.begin + self.out - self.seek:
|
||||
|
||||
self.peperation_task(index, node)
|
||||
self.peperation_task(index, self.node)
|
||||
self.first = False
|
||||
break
|
||||
elif self.last_time < self.begin:
|
||||
@ -246,7 +247,7 @@ class GetSourceFromPlaylist:
|
||||
else:
|
||||
self.last = False
|
||||
|
||||
self.peperation_task(index, node)
|
||||
self.peperation_task(index, self.node)
|
||||
break
|
||||
|
||||
self.begin += self.out - self.seek
|
||||
|
Loading…
x
Reference in New Issue
Block a user