From 71766fed47a21ac445fce6f250c0846d1d4e2ba3 Mon Sep 17 00:00:00 2001 From: CaliforniaMountainSnake Date: Thu, 27 Feb 2020 20:59:26 +0300 Subject: [PATCH] Added the BC Layer alias for some phpunit methods to fix build at php <= 5.5. --- README.md | 4 +-- .../Filters/ComplexMedia/TestSrcFilter.php | 25 +++++++++++++++++++ tests/BaseTestCase.php | 13 +++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae908ec..a6603ee 100644 --- a/README.md +++ b/README.md @@ -532,7 +532,7 @@ ComplexMedia already contains some built-in filters. For example: ```php -$complexMedia = $ffmpeg->openComplex(array ('video_1.mp4', 'video_2.mp4')); +$complexMedia = $ffmpeg->openComplex(array('video_1.mp4', 'video_2.mp4')); $complexMedia->filters() ->custom('[0:v][1:v]', 'hstack', '[v]'); $complexMedia @@ -580,7 +580,7 @@ As you can see, you can take multiple input sources, perform the complicated pro You do not have to use `-filter_complex`. For example, just extract the audio from the video: ```php -$complexMedia = $ffmpeg->openComplex(array ('video.mp4')); +$complexMedia = $ffmpeg->openComplex(array('video.mp4')); $complexMedia ->map(array('0:a'), new Mp3(), 'output.mp3') ->save(); diff --git a/src/FFMpeg/Filters/ComplexMedia/TestSrcFilter.php b/src/FFMpeg/Filters/ComplexMedia/TestSrcFilter.php index 139731c..265f60f 100644 --- a/src/FFMpeg/Filters/ComplexMedia/TestSrcFilter.php +++ b/src/FFMpeg/Filters/ComplexMedia/TestSrcFilter.php @@ -199,6 +199,31 @@ class TestSrcFilter extends AbstractComplexFilter return $this->type; } + /** + * Get minimal version of ffmpeg starting with which this filter is supported. + * + * @return string + */ + public function getMinimalFFMpegVersion() + { + switch ($this->type) { + case self::PAL75BARS: + case self::PAL100BARS: + return '4.1'; + case self::YUVTESTSRC: + return '3.2'; + case self::ALLRGB: + case self::ALLYUV: + return '2.8'; + case self::SMPTEHDBARS: + return '2.0'; + case self::SMPTEBARS: + return '1.0'; + default: + return '0.3'; + } + } + /** * {@inheritdoc} */ diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 75f8877..f32ff49 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -8,7 +8,8 @@ use PHPUnit\Framework\TestCase; * This is a BC Layer to support phpunit 4.8 needed for php <= 5.5. */ if (class_exists('PHPUnit_Runner_Version') - && version_compare(\PHPUnit_Runner_Version::id(), '5', '<')) { + && version_compare(\PHPUnit_Runner_Version::id(), '5', '<') +) { class BaseTestCase extends TestCase { public static function assertScalar($value, $message = '') @@ -40,6 +41,16 @@ if (class_exists('PHPUnit_Runner_Version') { $this->setExpectedException($exception, $message); } + + public static function assertStringContainsString($needle, $haystack, $message = '') + { + self::assertContains($needle, $haystack, $message); + } + + public static function assertStringNotContainsString($needle, $haystack, $message = '') + { + self::assertNotContains($needle, $haystack, $message); + } } } else { class BaseTestCase extends TestCase