Add option to service provider for ffmpeg threads number
This commit is contained in:
		
					parent
					
						
							
								52cd1bc8d8
							
						
					
				
			
			
				commit
				
					
						e1c8862248
					
				
			
		
					 2 changed files with 15 additions and 2 deletions
				
			
		|  | @ -25,10 +25,12 @@ class FFMpegServiceProvider implements ServiceProviderInterface | ||||||
| 
 | 
 | ||||||
|         $app['ffmpeg.ffmpeg'] = $app->share(function(Application $app) { |         $app['ffmpeg.ffmpeg'] = $app->share(function(Application $app) { | ||||||
|             if (isset($app['ffmpeg.ffmpeg.binary'])) { |             if (isset($app['ffmpeg.ffmpeg.binary'])) { | ||||||
|                 return new FFMpeg($app['ffmpeg.ffmpeg.binary'], $app['ffmpeg.logger']); |                 $ffmpeg = new FFMpeg($app['ffmpeg.ffmpeg.binary'], $app['ffmpeg.logger']); | ||||||
|             } else { |             } else { | ||||||
|                 return FFMpeg::load($app['ffmpeg.logger']); |                 $ffmpeg = FFMpeg::load($app['ffmpeg.logger']); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             return $ffmpeg->setThreads(isset($app['ffmpeg.threads']) ? $app['ffmpeg.threads'] : 1); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         $app['ffmpeg.ffprobe'] = $app->share(function(Application $app) { |         $app['ffmpeg.ffprobe'] = $app->share(function(Application $app) { | ||||||
|  |  | ||||||
|  | @ -68,5 +68,16 @@ class FFMpegServiceProviderTest extends \PHPUnit_Framework_TestCase | ||||||
|         $this->assertInstanceOf('\\FFMpeg\\FFProbe', $app['ffmpeg.ffprobe']); |         $this->assertInstanceOf('\\FFMpeg\\FFProbe', $app['ffmpeg.ffprobe']); | ||||||
|         $this->assertInstanceOf('\\FFMpeg\\FFMpeg', $app['ffmpeg.ffmpeg']); |         $this->assertInstanceOf('\\FFMpeg\\FFMpeg', $app['ffmpeg.ffmpeg']); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @covers FFMpeg\FFMpegServiceProvider::register | ||||||
|  |      */ | ||||||
|  |     public function testCustomThreadsFFMpeg() | ||||||
|  |     { | ||||||
|  |         $app = $this->getApplication(); | ||||||
|  |         $app->register(new FFMpegServiceProvider(), array('ffmpeg.threads'=>18)); | ||||||
|  | 
 | ||||||
|  |         $this->assertEquals(18, $app['ffmpeg.ffmpeg']->getThreads()); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue