Avifinfo
Parser::parse_ftyp()
Parses a file stream.
The file type is checked through the "ftyp" box.
Метод класса: Parser{}
Хуков нет.
Возвращает
true|false
. True if the input stream is an AVIF bitstream or false.
Использование
$Parser = new Parser(); $Parser->parse_ftyp();
Код Parser::parse_ftyp() Parser::parse ftyp WP 6.6.2
public function parse_ftyp() { $box = new Box(); $status = $box->parse( $this->handle, $this->num_parsed_boxes ); if ( $status != FOUND ) { return false; } if ( $box->type != 'ftyp' ) { return false; } // Iterate over brands. See ISO/IEC 14496-12:2012(E) 4.3.1 if ( $box->content_size < 8 ) { return false; } for ( $i = 0; $i + 4 <= $box->content_size; $i += 4 ) { if ( !( $data = read( $this->handle, 4 ) ) ) { return false; } if ( $i == 4 ) { continue; // Skip minor_version. } if ( substr( $data, 0, 4 ) == 'avif' || substr( $data, 0, 4 ) == 'avis' ) { return skip( $this->handle, $box->content_size - ( $i + 4 ) ); } if ( $i > 32 * 4 ) { return false; // Be reasonable. } } return false; // No AVIF brand no good. }