✨ Add copy format
This commit is contained in:
parent
d75d5c125b
commit
9abcb9ec1b
3 changed files with 25 additions and 10 deletions
18
src/Format/Copy.php
Normal file
18
src/Format/Copy.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Danjones\FFMpeg\Format;
|
||||||
|
|
||||||
|
use FFMpeg\Format\FormatInterface;
|
||||||
|
|
||||||
|
class Copy implements FormatInterface
|
||||||
|
{
|
||||||
|
public function getPasses()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExtraParams()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
namespace Danjones\FFMpeg\Format;
|
namespace Danjones\FFMpeg\Format;
|
||||||
|
|
||||||
use FFMpeg\Format\AudioInterface;
|
|
||||||
use FFMpeg\Format\FormatInterface;
|
use FFMpeg\Format\FormatInterface;
|
||||||
use FFMpeg\Format\ProgressListener\AbstractProgressListener;
|
|
||||||
|
|
||||||
interface SubtitleInterface extends FormatInterface
|
interface SubtitleInterface extends FormatInterface
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,18 +60,21 @@ class Stream
|
||||||
protected function parseCodec(): static
|
protected function parseCodec(): static
|
||||||
{
|
{
|
||||||
if ($this->codec instanceof VideoInterface) {
|
if ($this->codec instanceof VideoInterface) {
|
||||||
return $this->parseVideo();
|
$this->parseVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->codec instanceof AudioInterface) {
|
if ($this->codec instanceof AudioInterface) {
|
||||||
return $this->parseAudio();
|
$this->parseAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->codec instanceof Format\SubtitleInterface) {
|
if ($this->codec instanceof Format\SubtitleInterface) {
|
||||||
return $this->parseSubtitle();
|
$this->parseSubtitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->codec instanceof Format\Copy) {
|
||||||
|
$this->addFlag('c', 'copy');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlag('c', 'copy');
|
|
||||||
$this->parseExtras($this->codec->getExtraParameters());
|
$this->parseExtras($this->codec->getExtraParameters());
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
@ -82,7 +85,6 @@ class Stream
|
||||||
if (null !== ($codec = $this->codec->getSubtitleCodec())) {
|
if (null !== ($codec = $this->codec->getSubtitleCodec())) {
|
||||||
$this->addFlag('c', $codec);
|
$this->addFlag('c', $codec);
|
||||||
}
|
}
|
||||||
$this->parseExtras($this->codec->getExtraParameters());
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +102,6 @@ class Stream
|
||||||
if (null !== ($channels = $this->codec->getAudioChannels())) {
|
if (null !== ($channels = $this->codec->getAudioChannels())) {
|
||||||
$this->addFlag('ac', $channels);
|
$this->addFlag('ac', $channels);
|
||||||
}
|
}
|
||||||
$this->parseExtras($this->codec->getExtraParameters());
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
@ -115,9 +116,7 @@ class Stream
|
||||||
$this->addFlag('b', "{$kb}k");
|
$this->addFlag('b', "{$kb}k");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user passed some additional format parameters.
|
|
||||||
$this->parseExtras($this->codec->getAdditionalParameters());
|
$this->parseExtras($this->codec->getAdditionalParameters());
|
||||||
$this->parseExtras($this->codec->getExtraParameters());
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue