From 9abcb9ec1b0a6e61cdb2230691d0f7b2b5452275 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Fri, 26 Aug 2022 17:00:48 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20copy=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Format/Copy.php | 18 ++++++++++++++++++ src/Format/SubtitleInterface.php | 2 -- src/Stream.php | 15 +++++++-------- 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 src/Format/Copy.php diff --git a/src/Format/Copy.php b/src/Format/Copy.php new file mode 100644 index 0000000..cd504c0 --- /dev/null +++ b/src/Format/Copy.php @@ -0,0 +1,18 @@ +codec instanceof VideoInterface) { - return $this->parseVideo(); + $this->parseVideo(); } if ($this->codec instanceof AudioInterface) { - return $this->parseAudio(); + $this->parseAudio(); } 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()); return $this; @@ -82,7 +85,6 @@ class Stream if (null !== ($codec = $this->codec->getSubtitleCodec())) { $this->addFlag('c', $codec); } - $this->parseExtras($this->codec->getExtraParameters()); return $this; } @@ -100,7 +102,6 @@ class Stream if (null !== ($channels = $this->codec->getAudioChannels())) { $this->addFlag('ac', $channels); } - $this->parseExtras($this->codec->getExtraParameters()); return $this; } @@ -115,9 +116,7 @@ class Stream $this->addFlag('b', "{$kb}k"); } - // If the user passed some additional format parameters. $this->parseExtras($this->codec->getAdditionalParameters()); - $this->parseExtras($this->codec->getExtraParameters()); return $this; }