@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | if ($absPath === false) { |
90 | 90 | Server::get(LoggerInterface::class)->error( |
91 | - 'Failed to get local file to generate thumbnail for: ' . $file->getPath(), |
|
91 | + 'Failed to get local file to generate thumbnail for: '.$file->getPath(), |
|
92 | 92 | ['app' => 'core'] |
93 | 93 | ); |
94 | 94 | return null; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | return $result; |
112 | 112 | } |
113 | 113 | |
114 | - private function getSparseFile(File $file, int $size): string|false { |
|
114 | + private function getSparseFile(File $file, int $size): string | false { |
|
115 | 115 | // File is smaller than $size or file is larger than max int size |
116 | 116 | // of the host so return false so getLocalFile method is used |
117 | 117 | if (($size >= $file->getSize()) || ($file->getSize() > PHP_INT_MAX)) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $absPath = Server::get(ITempManager::class)->getTemporaryFile(); |
129 | 129 | if ($absPath === false) { |
130 | 130 | Server::get(LoggerInterface::class)->error( |
131 | - 'Failed to get sparse file to generate thumbnail: ' . $file->getPath(), |
|
131 | + 'Failed to get sparse file to generate thumbnail: '.$file->getPath(), |
|
132 | 132 | ['app' => 'core'] |
133 | 133 | ); |
134 | 134 | fclose($content); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $sparseFile = fopen($absPath, 'w'); |
138 | 138 | |
139 | 139 | // Firsts 4 bytes indicate length of 1st atom. |
140 | - $ftypSize = (int)hexdec(bin2hex(stream_get_contents($content, 4, 0))); |
|
140 | + $ftypSize = (int) hexdec(bin2hex(stream_get_contents($content, 4, 0))); |
|
141 | 141 | // Download next 4 bytes to find name of 1st atom. |
142 | 142 | $ftypLabel = stream_get_contents($content, 4, 4); |
143 | 143 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | // EOF is reached |
153 | 153 | while (($offset + 8 < $file->getSize()) && ($moovSize === 0)) { |
154 | 154 | // First 4 bytes of atom header indicates size of the atom. |
155 | - $atomSize = (int)hexdec(bin2hex(stream_get_contents($content, 4, (int)$offset))); |
|
155 | + $atomSize = (int) hexdec(bin2hex(stream_get_contents($content, 4, (int) $offset))); |
|
156 | 156 | // Next 4 bytes of atom header is the name/label of the atom |
157 | - $atomLabel = stream_get_contents($content, 4, (int)($offset + 4)); |
|
157 | + $atomLabel = stream_get_contents($content, 4, (int) ($offset + 4)); |
|
158 | 158 | // Size value has two special values that don't directly indicate size |
159 | 159 | // 0 = atom size equals the rest of the file |
160 | 160 | if ($atomSize === 0) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // 1 = read an additional 8 bytes after the label to get the 64 bit |
164 | 164 | // size of the atom. Needed for large atoms like 'mdat' (the video data) |
165 | 165 | if ($atomSize === 1) { |
166 | - $atomSize = (int)hexdec(bin2hex(stream_get_contents($content, 8, (int)($offset + 8)))); |
|
166 | + $atomSize = (int) hexdec(bin2hex(stream_get_contents($content, 8, (int) ($offset + 8)))); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | // Found the 'moov' atom, store its location and size |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | // Generate new file of same size |
191 | - ftruncate($sparseFile, (int)($file->getSize())); |
|
191 | + ftruncate($sparseFile, (int) ($file->getSize())); |
|
192 | 192 | fseek($sparseFile, 0); |
193 | 193 | fseek($content, 0); |
194 | 194 | // Copy first $size bytes of video into new file |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | // so no need to download it again. |
199 | 199 | if ($moovOffset >= $size) { |
200 | 200 | // Seek to where 'moov' atom needs to be placed |
201 | - fseek($content, (int)$moovOffset); |
|
202 | - fseek($sparseFile, (int)$moovOffset); |
|
203 | - stream_copy_to_stream($content, $sparseFile, (int)$moovSize, 0); |
|
201 | + fseek($content, (int) $moovOffset); |
|
202 | + fseek($sparseFile, (int) $moovOffset); |
|
203 | + stream_copy_to_stream($content, $sparseFile, (int) $moovSize, 0); |
|
204 | 204 | } |
205 | 205 | } else { |
206 | 206 | // 'ftyp' atom not found, not a valid MP4/MOV |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | private function useHdr(string $absPath): bool { |
217 | 217 | // load ffprobe path from configuration, otherwise generate binary path using ffmpeg binary path |
218 | - $ffprobe_binary = $this->config->getSystemValue('preview_ffprobe_path', null) ?? (pathinfo($this->binary, PATHINFO_DIRNAME) . '/ffprobe'); |
|
218 | + $ffprobe_binary = $this->config->getSystemValue('preview_ffprobe_path', null) ?? (pathinfo($this->binary, PATHINFO_DIRNAME).'/ffprobe'); |
|
219 | 219 | // run ffprobe on the video file to get value of "color_transfer" |
220 | - $test_hdr_cmd = [$ffprobe_binary,'-select_streams', 'v:0', |
|
220 | + $test_hdr_cmd = [$ffprobe_binary, '-select_streams', 'v:0', |
|
221 | 221 | '-show_entries', 'stream=color_transfer', |
222 | 222 | '-of', 'default=noprint_wrappers=1:nokey=1', |
223 | 223 | $absPath]; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $tmpPath = Server::get(ITempManager::class)->getTemporaryFile(); |
244 | 244 | if ($tmpPath === false) { |
245 | 245 | Server::get(LoggerInterface::class)->error( |
246 | - 'Failed to get local file to generate thumbnail for: ' . $absPath, |
|
246 | + 'Failed to get local file to generate thumbnail for: '.$absPath, |
|
247 | 247 | ['app' => 'core'] |
248 | 248 | ); |
249 | 249 | return null; |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | if ($this->useHdr($absPath)) { |
256 | 256 | // Force colorspace to '2020_ncl' because some videos are |
257 | 257 | // tagged incorrectly as 'reserved' resulting in fail if not forced. |
258 | - $cmd = [$this->binary, '-y', '-ss', (string)$second, |
|
258 | + $cmd = [$this->binary, '-y', '-ss', (string) $second, |
|
259 | 259 | '-i', $absPath, |
260 | 260 | '-f', 'mjpeg', '-vframes', '1', |
261 | 261 | '-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', |
262 | 262 | $tmpPath]; |
263 | 263 | } else { |
264 | 264 | // always default to generating preview using non-HDR command |
265 | - $cmd = [$this->binary, '-y', '-ss', (string)$second, |
|
265 | + $cmd = [$this->binary, '-y', '-ss', (string) $second, |
|
266 | 266 | '-i', $absPath, |
267 | 267 | '-f', 'mjpeg', '-vframes', '1', |
268 | 268 | $tmpPath]; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $stderr = trim(stream_get_contents($pipes[2])); |
281 | 281 | $stdout = trim(stream_get_contents($pipes[1])); |
282 | 282 | $returnCode = proc_close($proc); |
283 | - $output = $stdout . $stderr; |
|
283 | + $output = $stdout.$stderr; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | if ($returnCode === 0) { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $movieBinary = $binaryFinder->findBinaryPath('ffmpeg'); |
34 | 34 | if (is_string($movieBinary)) { |
35 | 35 | parent::setUp(); |
36 | - $this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT . '/tests/data/' . $this->fileName); |
|
36 | + $this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT.'/tests/data/'.$this->fileName); |
|
37 | 37 | $this->provider = new Movie(['movieBinary' => $movieBinary]); |
38 | 38 | } else { |
39 | 39 | $this->markTestSkipped('No Movie provider present'); |