} else {
    $parameter = "";
}
if (array_key_exists('channel', $query_str)) {
    $channel = $query_str["channel"];
} else {
    $channel = "10";
}
Logger::$PATH = Conf::LOGDIR;
Logger::getLogger(Conf::AJAXLOGFILE)->log("SOURCE: " . basename(__FILE__) . " REQUEST: " . http_build_query($_REQUEST, "", " "));
if ($state = file_get_contents(Conf::SETTINGS . "/" . $channel . "-playlist.json")) {
    $error = error_get_last();
} else {
    //
}
$playlist = new FflistClass($state);
// $playlist->fromJSON(file_get_contents($channel . "-playlist.json"));
switch ($command) {
    case 'get_playlist':
        echo $playlist->toJSON();
        break;
    case 'dir':
        echo VideoDirectory::scan($parameter);
        break;
    case 'add':
        echo $playlist->add($parameter);
        break;
    case 'remove':
        echo $playlist->remove($parameter);
        break;
    case 'move':
Beispiel #2
0
<?php

include 'playlist.class.php';
$SAVEPATH = "settings";
$query_str = $_GET;
if (array_key_exists('command', $query_str)) {
    $command = $query_str["command"];
} else {
    $command = "";
}
if (array_key_exists('seek', $query_str)) {
    $seek = $query_str["seek"];
} else {
    $seek = 0;
}
if (array_key_exists('channel', $query_str)) {
    $channel = $query_str["channel"];
} else {
    $channel = "10";
}
$myparsedlist = new FflistClass(file_get_contents($SAVEPATH . '/' . $channel . "-playlist.json"));
// $myparsedlist->fromJSON(file_get_contents($channel . "-playlist.json"));
$stream = $myparsedlist->toFFCONCAT($seek);
echo $stream["concat"];
Beispiel #3
0
$logfile = Conf::LOGDIR . "/" . $argv[2] . "-stream.state";
function isffconcat1($input, $seek = 0)
{
    $ext = explode("?", strtolower(pathinfo($input)['extension']))[0];
    // file_put_contents('ext.log', $ext);
    if (in_array($ext, ["php"])) {
        return " -f concat -i '" . $input . "&seek=" . $seek . "'";
    } elseif (in_array($ext, ["ffconcat", "ffcat", "txt", "lst"])) {
        return " -f concat -i '{$input}'";
    } else {
        return " -i '{$input}'";
    }
}
$seek = $argv[3];
if (Conf::FFMPEGLEGACY) {
    $myparsedlist = new FflistClass(file_get_contents(Conf::SAVEPATH . '/' . $argv[2] . "-playlist.json"));
    $ss = " -ss " . $myparsedlist->toFFCONCAT($seek)["ss"];
    if (intval($myparsedlist->toFFCONCAT($seek)["t"]) !== 0) {
        $t = " -t " . $myparsedlist->toFFCONCAT($seek)["t"];
    } else {
        $t = " ";
    }
} else {
    $ss = " ";
    $t = " ";
}
exec("pkill -f '^ffmpeg.*rtmp://127.0.0.1/wrapper/" . $argv[2] . "\$' &");
define("OUTPUT", " -c:v:0 copy  -c:a copy  -f flv -flags +global_header  rtmp://127.0.0.1/wrapper/");
$input = isffconcat1($argv[1], intval($seek));
$output = OUTPUT . $argv[2];
$log = ">{$logfile} 2>&1";