@@ -164,7 +205,12 @@ function split_file($path,$file,$destination,$add_to_chn=-1){
$pos_jp=strpos($s,START_JP);
$pos_tiff=strpos($s,START_TIFF);
if(($pos_jp===false)&&($pos_tiff===false)){
if(strlen($s)==$chunksize){
print("None of TIFF (".bin2hex(START_TIFF).") or JP4/JPEG (".bin2hex(START_JP).") markers found in the first ".$chunksize." bytes of the file $path/$file\n");
}else{
print("None of TIFF (".bin2hex(START_TIFF).") or JP4/JPEG (".bin2hex(START_JP).") markers found in the remaining ".strlen($s)." bytes of the file $path/$file\n");
}
return-1;
}
if($pos_jp===false){
@@ -183,34 +229,93 @@ function split_file($path,$file,$destination,$add_to_chn=-1){
while(!feof($f)){
$pos=0;
$index=0;
fseek($f,$offset);
fseek($f,$offset);// will read from the last
$s=fread($f,$chunksize);
if($next_file&&(strlen($s)<$chunksize)){// special case, try to add beginning of the next file
printf("Looking for the marker in the file split, using %s",$next_file);
$end_pos=strpos($s,END_JP,MIN_JP_LEN);// PHP Warning: strpos(): Offset not contained in string in /home/elphel/git/elphel-tools-x393/extract_images_tiff.php on line 254
}
if(!$end_pos&&$next_path){// try reading from the next file define('MAX_IMG_LEN', 0x1000000); // maximal image size (16M) to look for the end marker
$f1=fopen($next_path,"r");
$s.=fread($f1,MAX_IMG_LEN);// beginning of the next file
fclose($f1);
$end_pos=strpos($s,END_JP,MIN_JP_LEN);// PHP Warning: strpos(): Offset not contained in string in /home/elphel/git/elphel-tools-x393/extract_images_tiff.php on line 254
if($end_pos&&(DEBUG_LEVEL>=1)){
printf("Found image continued in the next file %s\n",$next_path);