-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFFMPEGStatic.php
43 lines (38 loc) · 1.02 KB
/
FFMPEGStatic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Created by PhpStorm.
* User: dhiraj
* Date: 8/16/17
* Time: 7:45 PM
*/
namespace traversient\yii;
use yii\base\Component;
use yii\base\InvalidConfigException;
class FFMPEGStatic extends Component
{
static function basePath(){
$os = php_uname("s");
$arch = php_uname("m");
$binOS = "";
if (
strtoupper(substr($os, 0, 3)) !== 'LIN' && //Linux
strtoupper(substr($os, 0, 3)) !== 'DAR' //Darwin
)
{
throw new InvalidConfigException();
}
if (strtoupper(substr($os, 0, 3)) === 'LIN'){
$binOS = "linux";
}
if (strtoupper(substr($os, 0, 3)) === 'DAR'){
$binOS = "darwin";
}
return __DIR__.DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR.$binOS;
}
public static function FFMPEGPath(){
return self::basePath().DIRECTORY_SEPARATOR."ffmpeg";
}
public static function FFPROBEPath(){
return self::basePath().DIRECTORY_SEPARATOR."ffprobe";
}
}