Parameter on ClipFilter made optional
This commit is contained in:
		
					parent
					
						
							
								ba7bd90780
							
						
					
				
			
			
				commit
				
					
						3fb918a7e2
					
				
			
		
					 2 changed files with 10 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								src/FFMpeg/Filters/Video/ClipFilter.php
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										11
									
								
								src/FFMpeg/Filters/Video/ClipFilter.php
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -24,7 +24,7 @@ class ClipFilter implements VideoFilterInterface | ||||||
|     /** @var integer */ |     /** @var integer */ | ||||||
|     private $priority; |     private $priority; | ||||||
| 
 | 
 | ||||||
|     public function __construct(TimeCode $start, TimeCode $duration, $priority = 0) |     public function __construct(TimeCode $start, TimeCode $duration = null, $priority = 0) | ||||||
|     { |     { | ||||||
|     	$this->start = $start; |     	$this->start = $start; | ||||||
|     	$this->duration = $duration; |     	$this->duration = $duration; | ||||||
|  | @ -60,6 +60,13 @@ class ClipFilter implements VideoFilterInterface | ||||||
|      */ |      */ | ||||||
|     public function apply(Video $video, VideoInterface $format) |     public function apply(Video $video, VideoInterface $format) | ||||||
|     { |     { | ||||||
|     	return array('-ss', $this->start->__toString(), '-t', $this->duration->__toString()); |     	$commands = array('-ss', (string) $this->start); | ||||||
|  |     	 | ||||||
|  |     	if($this->duration !== null) { | ||||||
|  |     	  $commands[] = '-t'; | ||||||
|  |     	  $commands[] = (string) $this->duration; | ||||||
|  |     	} | ||||||
|  |     	 | ||||||
|  |     	return $commands; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								src/FFMpeg/Filters/Video/VideoFilters.php
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										2
									
								
								src/FFMpeg/Filters/Video/VideoFilters.php
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -75,7 +75,7 @@ class VideoFilters extends AudioFilters | ||||||
|      * |      * | ||||||
|      * @return VideoFilters |      * @return VideoFilters | ||||||
|      */ |      */ | ||||||
|     public function clip($start, $duration) |     public function clip($start, $duration = null) | ||||||
|     { |     { | ||||||
|         $this->media->addFilter(new ClipFilter($start, $duration)); |         $this->media->addFilter(new ClipFilter($start, $duration)); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue