src/StreamExtractor.php
private function manuallyDetermineHeaderLength()
    {
        // This separator is part of the Start Game command, which is the very
        // first command in the recorded game body. It's … reasonably accurate.
        $separator = pack('c*', 0xF4, 0x01, 0x00, 0x00);
        // We need to reset the file pointer when we're done
        $initialBase = ftell($this->fp);

        $base = $initialBase;
        $buffer = '';
        while (($buffer = fread($this->fp, 8192)) !== false) {
            $index = strpos($buffer, $separator);
            if ($index !== false) {
                $this->headerLen = $base + $index - 4;
                break;
            }
            $base += strlen($buffer);
        }
        fseek($this->fp, $initialBase);
    }
private function manuallyDetermineHeaderLength()
    {
        // This separator is part of the Start Game command, which is the very
        // first command in the recorded game body. It's … reasonably accurate.
        $separator = pack('c*', 0xF4, 0x01, 0x00, 0x00);
        // We need to reset the file pointer when we're done
        $initialBase = ftell($this->fp);

        $base = $initialBase;
        $buffer = '';
        while (($buffer = fread($this->fp, 8192)) !== false) {
            $index = strpos($buffer, $separator);
            if ($index !== false) {
                $this->headerLen = $base + $index - 4;
                break;
            }
            $base += strlen($buffer);
        }
        fseek($this->fp, $initialBase);
    }
private function manuallyDetermineHeaderLength ( ) { // This separator is part of the Start Game command, which is the very // first command in the recorded game body. It's … reasonably accurate. $ separator = pack ( 'c*' , 0xF4 , 0x01 , 0x00 , 0x00 ) ; // We need to reset the file pointer when we're done $ initialBase = ftell ( $ this -> fp ) ; $ base = $ initialBase ; $ buffer = '' ; while ( ( $ buffer = fread ( $ this -> fp , 8192 ) ) !== false ) { $ index = strpos ( $ buffer , $ separator ) ; if ( $ index !== false ) { $ this -> headerLen = $ base + $ index - 4 ; break ; } $ base += strlen ( $ buffer ) ; } fseek ( $ this -> fp , $ initialBase ) ; }
Determine the header length if the Header Length field was not set in the
file.
Determine the header length if the Header Length field was not set in the file .