drop support for video without ffmpeg

This commit is contained in:
Shish 2018-09-09 10:21:56 +01:00
parent 38406ef33a
commit 1ed888611a

View File

@ -22,11 +22,9 @@ class VideoFileHandler extends DataHandlerExtension {
if($ffmpeg = shell_exec((PHP_OS == 'WINNT' ? 'where' : 'which') . ' ffmpeg')) {
//ffmpeg exists in PATH, check if it's executable, and if so, default to it instead of static
if(is_executable(strtok($ffmpeg, PHP_EOL))) {
$config->set_default_string('video_thumb_engine', 'ffmpeg');
$config->set_default_string('thumb_ffmpeg_path', 'ffmpeg');
}
} else {
$config->set_default_string('video_thumb_engine', 'static');
$config->set_default_string('thumb_ffmpeg_path', '');
}
@ -46,21 +44,9 @@ class VideoFileHandler extends DataHandlerExtension {
}
public function onSetupBuilding(SetupBuildingEvent $event) {
//global $config;
$thumbers = array(
'None' => 'static',
'ffmpeg' => 'ffmpeg'
);
$sb = new SetupBlock("Video Thumbnail Options");
$sb->add_choice_option("video_thumb_engine", $thumbers, "Engine: ");
//if($config->get_string("video_thumb_engine") == "ffmpeg") {
$sb->add_label("<br>Path to ffmpeg: ");
$sb->add_text_option("thumb_ffmpeg_path");
//}
// Some older versions of ffmpeg have trouble with the automatic aspect ratio scaling.
// This adds an option in the Board Config to disable the aspect ratio scaling.
@ -87,16 +73,6 @@ class VideoFileHandler extends DataHandlerExtension {
$ok = false;
switch($config->get_string("video_thumb_engine"))
{
default:
case 'static':
$outname = warehouse_path("thumbs", $hash);
copy("ext/handle_video/thumb.jpg", $outname);
$ok = true;
break;
case 'ffmpeg':
$ffmpeg = escapeshellcmd($config->get_string("thumb_ffmpeg_path"));
$w = (int)$config->get_int("thumb_width");
@ -122,8 +98,6 @@ class VideoFileHandler extends DataHandlerExtension {
}
log_debug('handle_video', "Generating thumbnail with command `$cmd`, returns $returnValue");
break;
}
return $ok;
}