Вход Регистрация
Файл: vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Video/CropFilter.php
Строк: 55
<?php

/*
 * This file is part of PHP-FFmpeg.
 *
 * (c) Alchemy <dev.team@alchemy.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FFMpegFiltersVideo;

use 
FFMpegCoordinateDimension;
use 
FFMpegCoordinatePoint;
use 
FFMpegFormatVideoInterface;
use 
FFMpegMediaVideo;

class 
CropFilter implements VideoFilterInterface
{
    
/** @var int */
    
protected $priority;
    
/** @var Dimension */
    
protected $dimension;
    
/** @var Point */
    
protected $point;

    public function 
__construct(Point $pointDimension $dimension$priority 0)
    {
        
$this->priority $priority;
        
$this->dimension $dimension;
        
$this->point $point;
    }

    
/**
     * {@inheritdoc}
     */
    
public function getPriority()
    {
        return 
$this->priority;
    }

    
/**
     * {@inheritdoc}
     */
    
public function apply(Video $videoVideoInterface $format)
    {
        foreach (
$video->getStreams()->videos() as $stream) {
            if (
$stream->has('width') && $stream->has('height')) {
                
$stream->set('width'$this->dimension->getWidth());
                
$stream->set('height'$this->dimension->getHeight());
            }
        }

        return [
            
'-filter:v',
            
'crop='.
            
$this->dimension->getWidth().':'.$this->dimension->getHeight().':'.$this->point->getX().':'.$this->point->getY(),
        ];
    }
}
Онлайн: 0
Реклама