|
9 | 9 |
|
10 | 10 | use OCP\Files\File; |
11 | 11 | use OCP\Files\FileInfo; |
| 12 | +use OCP\IConfig; |
12 | 13 | use OCP\IImage; |
13 | 14 | use OCP\Server; |
14 | | -use OCP\IConfig; |
15 | 15 | use Psr\Log\LoggerInterface; |
16 | 16 |
|
17 | 17 | class Movie extends ProviderV2 { |
@@ -132,34 +132,33 @@ private function generateThumbNail(int $maxX, int $maxY, string $absPath, int $s |
132 | 132 | '-f', 'mjpeg', '-vframes', '1', |
133 | 133 | $tmpPath]; |
134 | 134 | // 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'; |
136 | 136 | // run ffprobe on the video file to get value of "color_transfer" |
137 | 137 | $test_hdr_cmd = [$ffprobe_binary,'-select_streams', 'v:0', |
138 | 138 | '-show_entries', 'stream=color_transfer', |
139 | 139 | '-of', 'default=noprint_wrappers=1:nokey=1', |
140 | 140 | $absPath]; |
141 | 141 | $test_hdr_proc = proc_open($test_hdr_cmd, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $test_hdr_pipes); |
142 | 142 | $test_hdr_returnCode = -1; |
143 | | - $test_hdr_output = ""; |
| 143 | + $test_hdr_output = ''; |
144 | 144 | if (is_resource($test_hdr_proc)) { |
145 | 145 | $test_hdr_stdout = trim(stream_get_contents($test_hdr_pipes[1])); |
146 | 146 | $test_hdr_stderr = trim(stream_get_contents($test_hdr_pipes[2])); |
147 | 147 | $test_hdr_returnCode = proc_close($test_hdr_proc); |
148 | 148 | // 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 { |
152 | 151 | $ffmpeg_libzimg_installed = false; |
153 | | - } |
| 152 | + } |
154 | 153 | // Only values of "smpte2084" and "arib-std-b67" indicate an HDR video so change $cmd to generate for HDR. |
155 | 154 | // Force colorspace to '2020_ncl' because some videos are tagged incorrectly as 'reserved' resulting in fail |
156 | 155 | // Otherwise, it is SDR, so do nothing. |
157 | 156 | if (($test_hdr_stdout === 'smpte2084' || $test_hdr_stdout === 'arib-std-b67') && $ffmpeg_libzimg_installed !== false) { |
158 | 157 | $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]; |
163 | 162 | } |
164 | 163 | } else { |
165 | 164 | // Not supported |
|
0 commit comments