Skip to content

Commit dd0aa62

Browse files
committed
Test commit
Signed-off-by: KT <invario@gmail.com>
1 parent 114afb8 commit dd0aa62

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

lib/private/Preview/Movie.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
use OCP\Files\File;
1111
use OCP\Files\FileInfo;
12+
use OCP\IConfig;
1213
use OCP\IImage;
1314
use OCP\Server;
14-
use OCP\IConfig;
1515
use Psr\Log\LoggerInterface;
1616

1717
class Movie extends ProviderV2 {
@@ -132,34 +132,33 @@ private function generateThumbNail(int $maxX, int $maxY, string $absPath, int $s
132132
'-f', 'mjpeg', '-vframes', '1',
133133
$tmpPath];
134134
// load ffprobe path from configuration, otherwise generate binary path using ffmpeg binary path
135-
$ffprobe_binary = is_string($this->config->getSystemValue('preview_ffprobe_path',null)) ? $this->config->getSystemValue('preview_ffprobe_path',null) : pathinfo($this->binary,PATHINFO_DIRNAME) . '/ffprobe';
135+
$ffprobe_binary = is_string($this->config->getSystemValue('preview_ffprobe_path', null)) ? $this->config->getSystemValue('preview_ffprobe_path', null) : pathinfo($this->binary, PATHINFO_DIRNAME) . '/ffprobe';
136136
// run ffprobe on the video file to get value of "color_transfer"
137137
$test_hdr_cmd = [$ffprobe_binary,'-select_streams', 'v:0',
138138
'-show_entries', 'stream=color_transfer',
139139
'-of', 'default=noprint_wrappers=1:nokey=1',
140140
$absPath];
141141
$test_hdr_proc = proc_open($test_hdr_cmd, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $test_hdr_pipes);
142142
$test_hdr_returnCode = -1;
143-
$test_hdr_output = "";
143+
$test_hdr_output = '';
144144
if (is_resource($test_hdr_proc)) {
145145
$test_hdr_stdout = trim(stream_get_contents($test_hdr_pipes[1]));
146146
$test_hdr_stderr = trim(stream_get_contents($test_hdr_pipes[2]));
147147
$test_hdr_returnCode = proc_close($test_hdr_proc);
148148
// search build options for libzimg (provides zscale filter)
149-
$ffmpeg_libzimg_installed = strpos($test_hdr_stderr,'--enable-libzimg');
150-
}
151-
else {
149+
$ffmpeg_libzimg_installed = strpos($test_hdr_stderr, '--enable-libzimg');
150+
} else {
152151
$ffmpeg_libzimg_installed = false;
153-
}
152+
}
154153
// Only values of "smpte2084" and "arib-std-b67" indicate an HDR video so change $cmd to generate for HDR.
155154
// Force colorspace to '2020_ncl' because some videos are tagged incorrectly as 'reserved' resulting in fail
156155
// Otherwise, it is SDR, so do nothing.
157156
if (($test_hdr_stdout === 'smpte2084' || $test_hdr_stdout === 'arib-std-b67') && $ffmpeg_libzimg_installed !== false) {
158157
$cmd = [$this->binary, '-y', '-ss', (string)$second,
159-
'-i', $absPath,
160-
'-f', 'mjpeg', '-vframes', '1',
161-
'-vf', 'zscale=min=2020_ncl:t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p',
162-
$tmpPath];
158+
'-i', $absPath,
159+
'-f', 'mjpeg', '-vframes', '1',
160+
'-vf', 'zscale=min=2020_ncl:t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p',
161+
$tmpPath];
163162
}
164163
} else {
165164
// Not supported

0 commit comments

Comments
 (0)