title text does not need to generate a new image each frame
This commit is contained in:
parent
db7acbf3ea
commit
75f1e8af76
|
@ -87,6 +87,7 @@ class Component:
|
||||||
def preFrameRender(self, **kwargs):
|
def preFrameRender(self, **kwargs):
|
||||||
for kwarg, value in kwargs.items():
|
for kwarg, value in kwargs.items():
|
||||||
exec('self.%s = value' % kwarg)
|
exec('self.%s = value' % kwarg)
|
||||||
|
return ['static']
|
||||||
|
|
||||||
def frameRender(self, moduleNo, frameNo):
|
def frameRender(self, moduleNo, frameNo):
|
||||||
width = int(self.worker.core.settings.value('outputWidth'))
|
width = int(self.worker.core.settings.value('outputWidth'))
|
||||||
|
|
|
@ -77,10 +77,15 @@ class Worker(QtCore.QObject):
|
||||||
|
|
||||||
# initialize components
|
# initialize components
|
||||||
print('######################## Data')
|
print('######################## Data')
|
||||||
print('loaded components: ', [str(component) for component in components])
|
print('loaded components:',
|
||||||
|
["%s%s" % (num, str(component)) for num, component in enumerate(components)])
|
||||||
|
staticComponents = {}
|
||||||
sampleSize = 1470
|
sampleSize = 1470
|
||||||
for component in components:
|
for compNo, comp in enumerate(components):
|
||||||
component.preFrameRender(worker=self, completeAudioArray=completeAudioArray, sampleSize=sampleSize)
|
properties = None
|
||||||
|
properties = comp.preFrameRender(worker=self, completeAudioArray=completeAudioArray, sampleSize=sampleSize)
|
||||||
|
if properties and 'static' in properties:
|
||||||
|
staticComponents[compNo] = None
|
||||||
|
|
||||||
# create video for output
|
# create video for output
|
||||||
numpy.seterr(divide='ignore')
|
numpy.seterr(divide='ignore')
|
||||||
|
@ -88,18 +93,25 @@ class Worker(QtCore.QObject):
|
||||||
bgI = 0
|
bgI = 0
|
||||||
for i in range(0, len(completeAudioArray), sampleSize):
|
for i in range(0, len(completeAudioArray), sampleSize):
|
||||||
newFrame = Image.new("RGBA", (int(self.core.settings.value('outputWidth')), int(self.core.settings.value('outputHeight'))),(0,0,0,255))
|
newFrame = Image.new("RGBA", (int(self.core.settings.value('outputWidth')), int(self.core.settings.value('outputHeight'))),(0,0,0,255))
|
||||||
|
|
||||||
if imBackground:
|
if imBackground:
|
||||||
newFrame.paste(imBackground)
|
newFrame.paste(imBackground)
|
||||||
else:
|
else:
|
||||||
newFrame.paste(getBackgroundAtIndex(bgI))
|
newFrame.paste(getBackgroundAtIndex(bgI))
|
||||||
|
|
||||||
|
# composite all frames returned by the components in order
|
||||||
for compNo, comp in enumerate(components):
|
for compNo, comp in enumerate(components):
|
||||||
newFrame = Image.alpha_composite(newFrame,comp.frameRender(compNo, i))
|
if compNo in staticComponents and staticComponents[compNo] != None:
|
||||||
|
newFrame = Image.alpha_composite(newFrame,staticComponents[compNo])
|
||||||
|
else:
|
||||||
|
newFrame = Image.alpha_composite(newFrame,comp.frameRender(compNo, i))
|
||||||
|
if i == 0 and compNo in staticComponents:
|
||||||
|
staticComponents[compNo] = comp.frameRender(compNo, i)
|
||||||
|
|
||||||
if not imBackground:
|
if not imBackground:
|
||||||
|
# increment background video frame for next iteration
|
||||||
if bgI < len(backgroundFrames)-1:
|
if bgI < len(backgroundFrames)-1:
|
||||||
bgI += 1
|
bgI += 1
|
||||||
|
|
||||||
# write to out_pipe
|
# write to out_pipe
|
||||||
try:
|
try:
|
||||||
frame = Image.new("RGB", (int(self.core.settings.value('outputWidth')), int(self.core.settings.value('outputHeight'))),(0,0,0))
|
frame = Image.new("RGB", (int(self.core.settings.value('outputWidth')), int(self.core.settings.value('outputHeight'))),(0,0,0))
|
||||||
|
|
Reference in New Issue