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']