Parses a “meta” box.
Description
It looks for the primary item ID in the "pitm" box and recurses into other boxes to find its features.
Parameters
$handle
Avifinfostreamrequired- The resource the box will be parsed from.
$num_remaining_bytes
intrequired- The number of bytes that should be available from the resource.
Source
private function parse_meta( $num_remaining_bytes ) {
do {
$box = new Box();
$status = $box->parse( $this->handle, $this->num_parsed_boxes, $num_remaining_bytes );
if ( $status != FOUND ) {
return $status;
}
if ( $box->type == 'pitm' ) {
// See ISO/IEC 14496-12:2015(E) 8.11.4.2
$num_bytes_per_id = ( $box->version == 0 ) ? 2 : 4;
if ( $num_bytes_per_id > $num_remaining_bytes ) {
return INVALID;
}
if ( !( $data = read( $this->handle, $num_bytes_per_id ) ) ) {
return TRUNCATED;
}
$primary_item_id = read_big_endian( $data, $num_bytes_per_id );
if ( $primary_item_id > MAX_VALUE ) {
return ABORTED;
}
$this->features->has_primary_item = true;
$this->features->primary_item_id = $primary_item_id;
if ( !skip( $this->handle, $box->content_size - $num_bytes_per_id ) ) {
return TRUNCATED;
}
} else if ( $box->type == 'iprp' ) {
$status = $this->parse_iprp( $box->content_size );
if ( $status != NOT_FOUND ) {
return $status;
}
} else if ( $box->type == 'iref' ) {
$status = $this->parse_iref( $box->content_size );
if ( $status != NOT_FOUND ) {
return $status;
}
} else {
if ( !skip( $this->handle, $box->content_size ) ) {
return TRUNCATED;
}
}
$num_remaining_bytes -= $box->size;
} while ( $num_remaining_bytes != 0 );
// According to ISO/IEC 14496-12:2012(E) 8.11.1.1 there is at most one "meta".
return INVALID;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.