*
* @par License:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
?>
=0){
if (isset($_GET['trig'])){
// just in case one wants to override master
if (isset($_GET['port'])){
$trig_master_port = $_GET['port'];
}
$f = fopen("http://{$_SERVER['SERVER_ADDR']}:$trig_master_port/trig/pointers", 'r');
fclose($f);
die("trigger ok: http://{$_SERVER['SERVER_ADDR']}:$trig_master_port/trig/pointers");
}
if (isset($_GET['zip'])){
$contents = Array();
$filenames = Array();
$rqs = Array();
foreach($available_ports as $port){
array_push($rqs,"http://{$_SERVER['SERVER_ADDR']}:$port/timestamp_name/bchn$base_channel/bimg");
}
// '1' in the end - get response with headers
$cdata = curl_multi_start($rqs,1);
// '1' in the end - parse response with headers
$results = curl_multi_finish($cdata,false,0,false,1);
$filenames = $results['names'];
$contents = $results['contents'];
/*
foreach($available_ports as $port){
//exec("wget --content-disposition -P $tmpdir http://{$_SERVER['SERVER_ADDR']}:$port/timestamp_name/bimg");
//fopen("http://{$_SERVER['SERVER_ADDR']}:$port/timestamp_name/bimg",'r');
$content = file_get_contents("http://{$_SERVER['SERVER_ADDR']}:$port/timestamp_name/bimg");
$filename = get_filename_from_headers($http_response_header);
if ($filename==""){
$filename = "bimg.jp4";
}
array_push($filenames,$filename);
array_push($contents,$content);
}
*/
$zipfilename = preg_replace("/_\d+\.jp(4|.*g)$/",".zip",$filenames[0]);
//tmpfile
$tmpfile = tmpfile();
$tmpfilename = stream_get_meta_data($tmpfile)['uri'];
$zip = new ZipArchive;
if ($zip->open($tmpfilename, ZipArchive::OVERWRITE)!==TRUE) {
die("cannot access temporary file <$tmpfilename>\n");
}
foreach($filenames as $k=>$v){
$zip->addFromString($v,$contents[$k]);
}
if (isset($_GET['exifs'])){
foreach($available_ports as $k=>$v){
$i = $v-$port0;
$fname = $filenames[$k];
$v_new = preg_replace("/\.jp(4|.*g)$/","_exifs.txt",$fname);
$exifs = get_all_exifs($i);
$zip->addFromString($v_new,var_export($exifs,true));
}
}
$zip->close();
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zipfilename.'"');
echo file_get_contents($tmpfilename);
die();
}
// get exif data from all buffers in a single text file
if (isset($_GET['exifs'])){
if (isset($_GET['sensor_port'])){
$port = $_GET['sensor_port'];
}else{
$port = $lowest_port;
}
$meta = get_all_exifs(intval($port));
print_r($meta);
die();
}
}
function get_all_exifs($port){
$circbuf_pointers = elphel_get_circbuf_pointers($port,1);
// get metas
$meta = array();
foreach($circbuf_pointers as $k=>$v){
$meta[$k] = array (
'circbuf_pointer' => $v['circbuf_pointer'],
'meta' => elphel_get_interframe_meta($port,$v['circbuf_pointer']),
'Exif' => elphel_get_exif_elphel($port, $v['exif_pointer'])
);
}
return $meta;
}
?>
Snapshot
zip
sync
if checked:
all ports - same timestamp
fps will be reprogrammed - set to single trigger mode then restored - careful if some other program is doing recording
if unchecked:
timestamps can be different
fps will not be reprogrammed - no intereference with other recording programs, only network load.