Вход Регистрация
Файл: vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Filters/Frame/DisplayRatioFixerFilter.php
Строк: 40
<?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 FFMpegFiltersFrame;

use 
FFMpegExceptionRuntimeException;
use 
FFMpegMediaFrame;

class 
DisplayRatioFixerFilter implements FrameFilterInterface
{
    
/** @var int */
    
private $priority;

    public function 
__construct($priority 0)
    {
        
$this->priority $priority;
    }

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

    
/**
     * {@inheritdoc}
     */
    
public function apply(Frame $frame)
    {
        
$dimensions null;
        
$commands = [];

        foreach (
$frame->getVideo()->getStreams() as $stream) {
            if (
$stream->isVideo()) {
                try {
                    
$dimensions $stream->getDimensions();
                    
$commands[] = '-s';
                    
$commands[] = $dimensions->getWidth().'x'.$dimensions->getHeight();
                    break;
                } catch (
RuntimeException $e) {
                }
            }
        }

        return 
$commands;
    }
}
Онлайн: 0
Реклама