Specify temporary directory + fix for default ffmpeg-passes* temporary directory (#855)
This commit is contained in:
parent
368def99a2
commit
bda300b69a
9 changed files with 119 additions and 35 deletions
|
|
@ -14,6 +14,7 @@ namespace FFMpeg\Media;
|
|||
use FFMpeg\Driver\FFMpegDriver;
|
||||
use FFMpeg\FFProbe;
|
||||
use FFMpeg\Filters\FiltersCollection;
|
||||
use Spatie\TemporaryDirectory\TemporaryDirectory;
|
||||
|
||||
abstract class AbstractMediaType implements MediaTypeInterface
|
||||
{
|
||||
|
|
@ -96,6 +97,18 @@ abstract class AbstractMediaType implements MediaTypeInterface
|
|||
return $this->filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of TemporaryDirectory with the optionally configured directory.
|
||||
*
|
||||
* @return \Spatie\TemporaryDirectory\TemporaryDirectory
|
||||
*/
|
||||
public function getTemporaryDirectory(): TemporaryDirectory
|
||||
{
|
||||
return new TemporaryDirectory(
|
||||
$this->driver->getConfiguration()->get('temporary_directory') ?: ''
|
||||
);
|
||||
}
|
||||
|
||||
protected function cleanupTemporaryFile($filename)
|
||||
{
|
||||
if (file_exists($filename) && is_writable($filename)) {
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ abstract class AbstractVideo extends Audio
|
|||
}
|
||||
|
||||
$this->fsId = uniqid('ffmpeg-passes');
|
||||
$this->fs = (new TemporaryDirectory($this->fsId))->create();
|
||||
$this->fs = $this->getTemporaryDirectory()->name($this->fsId)->create();
|
||||
$passPrefix = $this->fs->path(uniqid('pass-'));
|
||||
touch($passPrefix);
|
||||
$passes = [];
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class Concat extends AbstractMediaType
|
|||
*/
|
||||
|
||||
// Create the file which will contain the list of videos
|
||||
$fs = (new TemporaryDirectory())->create();
|
||||
$fs = $this->getTemporaryDirectory()->create();
|
||||
$sourcesFile = $fs->path('ffmpeg.concat');
|
||||
|
||||
// Set the content of this file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue