Rename interfaces
This commit is contained in:
		
					parent
					
						
							
								e7918c03f7
							
						
					
				
			
			
				commit
				
					
						78bb1bd86e
					
				
			
		
					 13 changed files with 162 additions and 67 deletions
				
			
		|  | @ -19,18 +19,19 @@ namespace FFMpeg\Format; | |||
| interface Audio | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the audio codec | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getAudioCodec(); | ||||
| 
 | ||||
|     /** | ||||
|      * Get the kiloBitrate value | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getKiloBitrate(); | ||||
|      | ||||
|     /** | ||||
|      * Give som extra parameters to add to ffmpeg commandline | ||||
|      * Parameters MUST be escaped | ||||
|      *  | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getExtraParams(); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ use FFMpeg\Exception\InvalidArgumentException; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| abstract class DefaultAudio implements ResamplableAudio, InteractiveAudio | ||||
| abstract class DefaultAudio implements Resamplable, Interactive | ||||
| { | ||||
|     protected $audioCodec; | ||||
|     protected $audioSampleRate = 44100; | ||||
|  |  | |||
|  | @ -11,8 +11,6 @@ | |||
| 
 | ||||
| namespace FFMpeg\Format\Audio; | ||||
| 
 | ||||
| use FFMpeg\Format\Audio as BaseAudio; | ||||
| 
 | ||||
| /** | ||||
|  * The interactive audio interface. This provide a method to list available | ||||
|  * codecs. This is usefull to build interactive development and switch between | ||||
|  | @ -20,7 +18,7 @@ use FFMpeg\Format\Audio as BaseAudio; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface InteractiveAudio extends BaseAudio | ||||
| interface Interactive extends Transcodable | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|  | @ -20,7 +20,7 @@ use FFMpeg\Format\Audio as BaseAudio; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface ResamplableAudio extends BaseAudio | ||||
| interface Resamplable extends BaseAudio | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
							
								
								
									
										28
									
								
								src/FFMpeg/Format/Audio/Transcodable.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/FFMpeg/Format/Audio/Transcodable.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| <?php | ||||
| 
 | ||||
| /* | ||||
|  * This file is part of PHP-FFmpeg. | ||||
|  * | ||||
|  * (c) Alchemy <info@alchemy.fr> | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
| 
 | ||||
| namespace FFMpeg\Format\Audio; | ||||
| 
 | ||||
| use FFMpeg\Format\Audio as BaseAudio; | ||||
| 
 | ||||
| /** | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface Transcodable extends BaseAudio | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the audio codec | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getAudioCodec(); | ||||
| } | ||||
							
								
								
									
										43
									
								
								src/FFMpeg/Format/Dimension.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/FFMpeg/Format/Dimension.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| <?php | ||||
| 
 | ||||
| /* | ||||
|  * This file is part of PHP-FFmpeg. | ||||
|  * | ||||
|  * (c) Alchemy <info@alchemy.fr> | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
| 
 | ||||
| namespace FFMpeg\Format; | ||||
| 
 | ||||
| use FFMpeg\Exception\InvalidArgumentException; | ||||
| 
 | ||||
| /** | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| class Dimension | ||||
| { | ||||
|     protected $width; | ||||
|     protected $height; | ||||
| 
 | ||||
|     public function __construct($width, $height) | ||||
|     { | ||||
|         if ($width <= 0 || $height <= 0) { | ||||
|             throw InvalidArgumentException('Width and height should be positive integer'); | ||||
|         } | ||||
| 
 | ||||
|         $this->width = (int) $width; | ||||
|         $this->height = (int) $height; | ||||
|     } | ||||
| 
 | ||||
|     public function getWidth() | ||||
|     { | ||||
|         return $this->width; | ||||
|     } | ||||
| 
 | ||||
|     public function getHeight() | ||||
|     { | ||||
|         return $this->height; | ||||
|     } | ||||
| } | ||||
|  | @ -18,11 +18,5 @@ namespace FFMpeg\Format; | |||
|  */ | ||||
| interface Video extends Audio | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the video codec | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getVideoCodec(); | ||||
|      | ||||
| } | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ | |||
| namespace FFMpeg\Format\Video; | ||||
| 
 | ||||
| use FFMpeg\Format\Audio\DefaultAudio; | ||||
| use FFMpeg\Format\Dimension; | ||||
| use FFMpeg\Exception\InvalidArgumentException; | ||||
| 
 | ||||
| /** | ||||
|  | @ -19,7 +20,7 @@ use FFMpeg\Exception\InvalidArgumentException; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| abstract class DefaultVideo extends DefaultAudio implements InteractiveVideo, ResamplableVideo, ResizableVideo | ||||
| abstract class DefaultVideo extends DefaultAudio implements Interactive, Resamplable, Resizable | ||||
| { | ||||
|     const RESIZEMODE_FIT = 'fit'; | ||||
|     const RESIZEMODE_INSET = 'inset'; | ||||
|  | @ -33,7 +34,10 @@ abstract class DefaultVideo extends DefaultAudio implements InteractiveVideo, Re | |||
|     protected $kiloBitrate = 1000; | ||||
| 
 | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      * Returns the width setting. | ||||
|      * The return of this method should not depend on a media file size | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getWidth() | ||||
|     { | ||||
|  | @ -41,7 +45,10 @@ abstract class DefaultVideo extends DefaultAudio implements InteractiveVideo, Re | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      * Returns the height setting | ||||
|      * The return of this method should not depend on a media file size | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getHeight() | ||||
|     { | ||||
|  | @ -95,7 +102,7 @@ abstract class DefaultVideo extends DefaultAudio implements InteractiveVideo, Re | |||
|                 break; | ||||
|         } | ||||
| 
 | ||||
|         return array($width, $height); | ||||
|         return new Dimension($width, $height); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | @ -121,7 +128,9 @@ abstract class DefaultVideo extends DefaultAudio implements InteractiveVideo, Re | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      * Get the current resize mode name | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getResizeMode() | ||||
|     { | ||||
|  |  | |||
|  | @ -11,8 +11,6 @@ | |||
| 
 | ||||
| namespace FFMpeg\Format\Video; | ||||
| 
 | ||||
| use FFMpeg\Format\Video as BaseVideo; | ||||
| 
 | ||||
| /** | ||||
|  * The interactive video interface. This provide a method to list available | ||||
|  * codecs. This is usefull to build interactive development and switch between | ||||
|  | @ -20,7 +18,7 @@ use FFMpeg\Format\Video as BaseVideo; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface InteractiveVideo extends BaseVideo | ||||
| interface Interactive extends Transcodable | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|  | @ -20,7 +20,7 @@ use FFMpeg\Format\Video as BaseVideo; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface ResamplableVideo extends BaseVideo | ||||
| interface Resamplable extends BaseVideo | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|  | @ -12,6 +12,7 @@ | |||
| namespace FFMpeg\Format\Video; | ||||
| 
 | ||||
| use FFMpeg\Format\Video as BaseVideo; | ||||
| use FFMpeg\Format\Dimension; | ||||
| 
 | ||||
| /** | ||||
|  * The resizable video interface | ||||
|  | @ -20,39 +21,16 @@ use FFMpeg\Format\Video as BaseVideo; | |||
|  * | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface ResizableVideo extends BaseVideo | ||||
| interface Resizable extends BaseVideo | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the width setting. | ||||
|      * The return of this method should not depend on a media file size | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getWidth(); | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the height setting | ||||
|      * The return of this method should not depend on a media file size | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getHeight(); | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the computed dimensions for the resize, after operation. | ||||
|      * This method return the actual dimensions that FFmpeg will use. | ||||
|      * | ||||
|      * @param  integer $originalWidth | ||||
|      * @param  integer $originalHeight | ||||
|      * @return array   An indexed array containing the width and the height | ||||
|      * @return Dimension  A dimension | ||||
|      */ | ||||
|     public function getComputedDimensions($originalWidth, $originalHeight); | ||||
| 
 | ||||
|     /** | ||||
|      * Get the current resize mode name | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getResizeMode(); | ||||
| } | ||||
							
								
								
									
										29
									
								
								src/FFMpeg/Format/Video/Transcodable.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/FFMpeg/Format/Video/Transcodable.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| <?php | ||||
| 
 | ||||
| /* | ||||
|  * This file is part of PHP-FFmpeg. | ||||
|  * | ||||
|  * (c) Alchemy <info@alchemy.fr> | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
| 
 | ||||
| namespace FFMpeg\Format\Video; | ||||
| 
 | ||||
| use FFMpeg\Format\Video as BaseVideo; | ||||
| use FFMpeg\Format\Dimension; | ||||
| 
 | ||||
| /** | ||||
|  * @author Romain Neutron imprec@gmail.com | ||||
|  */ | ||||
| interface Transcodable extends BaseVideo | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the video codec | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getVideoCodec(); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue