@@ -77,8 +77,8 @@ class Transcoder extends Component
7777 * Returns a URL to the transcoded video or "" if it doesn't exist (at which
7878 * time it will create it).
7979 *
80- * @param $filePath path to the original video -OR- an Asset
81- * @param $videoOptions array of options for the video
80+ * @param $filePath string path to the original video -OR- an Asset
81+ * @param $videoOptions array of options for the video
8282 *
8383 * @return string URL of the transcoded video or ""
8484 */
@@ -180,7 +180,7 @@ public function getVideoUrl($filePath, $videoOptions): string
180180 $ result = Craft::$ app ->config ->get ("transcoderUrl " , "transcoder " ).$ destVideoFile ;
181181 } else {
182182 // Kick off the transcoding
183- $ pid = $ this ->_executeShellCommand ($ ffmpegCmd );
183+ $ pid = $ this ->executeShellCommand ($ ffmpegCmd );
184184 Craft::info ($ ffmpegCmd ."\nffmpeg PID: " .$ pid , __METHOD__ );
185185
186186 // Create a lockfile in tmp
@@ -194,8 +194,8 @@ public function getVideoUrl($filePath, $videoOptions): string
194194 /**
195195 * Returns a URL to a video thumbnail
196196 *
197- * @param $filePath path to the original video or an Asset
198- * @param $thumbnailOptions array of options for the thumbnail
197+ * @param $filePath string path to the original video or an Asset
198+ * @param $thumbnailOptions array of options for the thumbnail
199199 *
200200 * @return string URL of the video thumbnail
201201 */
@@ -241,7 +241,7 @@ public function getVideoThumbnailUrl($filePath, $thumbnailOptions): string
241241
242242 // If the thumbnail file already exists, return it. Otherwise, generate it and return it
243243 if (!file_exists ($ destThumbnailPath )) {
244- $ shellOutput = $ this ->_executeShellCommand ($ ffmpegCmd );
244+ $ shellOutput = $ this ->executeShellCommand ($ ffmpegCmd );
245245 Craft::info ($ ffmpegCmd , __METHOD__ );
246246 }
247247 $ result = Craft::$ app ->config ->get ("transcoderUrl " , "transcoder " ).$ destThumbnailFile ;
@@ -334,7 +334,7 @@ public function getAudioUrl($filePath, $audioOptions): string
334334 $ result = Craft::$ app ->config ->get ("transcoderUrl " , "transcoder " ).$ destAudioFile ;
335335 } else {
336336 // Kick off the transcoding
337- $ pid = $ this ->_executeShellCommand ($ ffmpegCmd );
337+ $ pid = $ this ->executeShellCommand ($ ffmpegCmd );
338338 Craft::info ($ ffmpegCmd ."\nffmpeg PID: " .$ pid , __METHOD__ );
339339
340340 // Create a lockfile in tmp
@@ -366,7 +366,7 @@ public function getFileInfo($filePath, $summary = false): array
366366 .' ' .$ ffprobeOptions
367367 .' ' .escapeshellarg ($ filePath );
368368
369- $ shellOutput = $ this ->_executeShellCommand ($ ffprobeCmd );
369+ $ shellOutput = $ this ->executeShellCommand ($ ffprobeCmd );
370370 Craft::info ($ ffprobeCmd , __METHOD__ );
371371 $ result = json_decode ($ shellOutput , true );
372372 Craft::info (print_r ($ result , true ), __METHOD__ );
@@ -393,7 +393,6 @@ public function getFileInfo($filePath, $summary = false): array
393393 $ summaryResult [$ settingValue ] = $ stream [$ settingKey ];
394394 }
395395 }
396-
397396 }
398397 break ;
399398 // Unknown info
@@ -546,6 +545,7 @@ protected function addScalingFfmpegArgs($options, $ffmpegCmd): string
546545 {
547546 if (!empty ($ options ['width ' ]) && !empty ($ options ['height ' ])) {
548547 // Handle "none", "crop", and "letterbox" aspectRatios
548+ $ aspectRatio = "" ;
549549 if (!empty ($ options ['aspectRatio ' ])) {
550550 switch ($ options ['aspectRatio ' ]) {
551551 // Scale to the appropriate aspect ratio, padding
@@ -603,7 +603,7 @@ protected function coalesceOptions($defaultName, $options): array
603603 return $ options ;
604604 }
605605
606- // Private Methods
606+ // Protected Methods
607607 // =========================================================================
608608
609609 /**
@@ -613,7 +613,7 @@ protected function coalesceOptions($defaultName, $options): array
613613 *
614614 * @return string
615615 */
616- private function _executeShellCommand (string $ command ): string
616+ protected function executeShellCommand (string $ command ): string
617617 {
618618 // Create the shell command
619619 $ shellCommand = new ShellCommand ();
0 commit comments