diff --git a/src/Filters/BaseFilter.php b/src/Filters/BaseFilter.php new file mode 100644 index 0000000..05c060c --- /dev/null +++ b/src/Filters/BaseFilter.php @@ -0,0 +1,46 @@ +properties as $key => $value) { + strpos($value, ' ') !== false + ? $properties[] = "{$key}='{$value}'" + : $properties[] = "{$key}={$value}"; + } + + $properties = implode(':', $properties); + + return "{$this->filter_name}={$properties}"; + } + + public function __toString(): string + { + return $this->build(); + } + + public function __call(string $name, array $arguments): self + { + $this->properties[$name] = (string) $arguments[0]; + + return $this; + } +} diff --git a/src/Filters/Traits/SupportsTimelineEditing.php b/src/Filters/Traits/SupportsTimelineEditing.php new file mode 100644 index 0000000..cc71b6e --- /dev/null +++ b/src/Filters/Traits/SupportsTimelineEditing.php @@ -0,0 +1,18 @@ +properties['enable'] = $value; + + return $this; + } +} diff --git a/src/Filters/Video/DrawText.php b/src/Filters/Video/DrawText.php new file mode 100644 index 0000000..442db2d --- /dev/null +++ b/src/Filters/Video/DrawText.php @@ -0,0 +1,130 @@ +timecode_rate($value); + } + + public function r(int $value): self + { + return $this->timecode_rate($value); + } +} diff --git a/tests/src/Filters/Video/DrawText.php b/tests/src/Filters/Video/DrawText.php new file mode 100644 index 0000000..9ab4b02 --- /dev/null +++ b/tests/src/Filters/Video/DrawText.php @@ -0,0 +1,15 @@ +text('Hello World') + ->x(10) + ->y(10) + ->fontSize(20) + ->fontColor('white') + ->box(1) + )->toEqual("drawtext=text='Hello World':x=10:y=10:fontsize=20:fontcolor=white:box=1"); +});