Added configuration for audio channels
This commit is contained in:
		
					parent
					
						
							
								4bea49478c
							
						
					
				
			
			
				commit
				
					
						7004e53399
					
				
			
		
					 8 changed files with 130 additions and 17 deletions
				
			
		|  | @ -27,6 +27,9 @@ abstract class DefaultAudio extends EventEmitter implements AudioInterface, Prog | |||
|     /** @var integer */ | ||||
|     protected $audioKiloBitrate = 128; | ||||
| 
 | ||||
|     /** @var integer */ | ||||
|     protected $audioChannels = null; | ||||
| 
 | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|  | @ -90,6 +93,31 @@ abstract class DefaultAudio extends EventEmitter implements AudioInterface, Prog | |||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
| 	/** | ||||
| 	 * {@inheritdoc} | ||||
| 	 */ | ||||
| 	public function getAudioChannels() | ||||
| 	{ | ||||
| 		return $this->audioChannels; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|      * Sets the channels value. | ||||
|      * | ||||
|      * @param  integer                  $channels | ||||
|      * @throws InvalidArgumentException | ||||
|      */ | ||||
|     public function setAudioChannels($channels) | ||||
|     { | ||||
|         if ($channels < 1) { | ||||
|             throw new InvalidArgumentException('Wrong channels value'); | ||||
|         } | ||||
| 
 | ||||
|         $this->audioChannels = (int) $channels; | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|  |  | |||
|  | @ -19,6 +19,13 @@ interface AudioInterface extends FormatInterface | |||
|      */ | ||||
|     public function getAudioKiloBitrate(); | ||||
| 
 | ||||
|     /** | ||||
|      * Gets the audio channels value. | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getAudioChannels(); | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the audio codec. | ||||
|      * | ||||
|  |  | |||
|  | @ -87,6 +87,10 @@ class Audio extends AbstractStreamableMedia | |||
|             $commands[] = '-b:a'; | ||||
|             $commands[] = $format->getAudioKiloBitrate() . 'k'; | ||||
|         } | ||||
|         if (null !== $format->getAudioChannels()) { | ||||
|             $commands[] = '-ac'; | ||||
|             $commands[] = $format->getAudioChannels(); | ||||
|         } | ||||
|         $commands[] = $outputPathfile; | ||||
| 
 | ||||
|         try { | ||||
|  |  | |||
|  | @ -114,6 +114,10 @@ class Video extends Audio | |||
|                 $commands[] = '-b:a'; | ||||
|                 $commands[] = $format->getAudioKiloBitrate() . 'k'; | ||||
|             } | ||||
| 	        if (null !== $format->getAudioChannels()) { | ||||
| 		        $commands[] = '-ac'; | ||||
| 		        $commands[] = $format->getAudioChannels(); | ||||
| 	        } | ||||
|         } | ||||
| 
 | ||||
|         $fs = FsManager::create(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue