Multi-DJ livestream toolkit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

40 lines
1.2 KiB

from ..filters import FFmpegChain, FFmpegFilter
from .base import OBSSource
class TextSource(OBSSource):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.font = None
self.size = 32
self.color = '#ffffff'
self.contents = ''
self.shadow = 0
self.shadow_color = '#000000'
def to_ffmpeg(self, scene):
return [], [FFmpegChain(
FFmpegFilter('drawtext',
expansion='none',
fontcolor=self.color,
font=self.font,
text=self.contents,
shadowcolor=self.shadow_color,
shadowx=self.shadow,
shadowy=self.shadow,
)
)]
@OBSSource.type('text_gdiplus')
class GDIPlusSource(TextSource):
def load(self, data):
self.font = data['settings']['font']['face']
self.size = data['settings']['font']['size']
self.color = data['settings']['color']
@OBSSource.type('text_ft2_source')
class FreeType2Source(TextSource):
def load(self, data):
self.font = data['settings']['font']['face']
self.size = data['settings']['font']['size']
self.color = data['settings']['color0']