static function nestedStart($tag, $media_tag) { $neg_one = floatval(-1); // start for a nested tag is the sum of its start and its parents $parent = $tag; $result = floatval((string) $parent['start']); while ($parent != NULL && (int) $parent['track'] < 0) { $child = $parent; $type = (string) $child['type']; $parent = MovieMasher_Coder_Decoder::parentTag($child); switch ($type) { case 'theme': // TODO: create a property for themes to indicate how many composites to utilize // TODO: create a property for themes to indicate how many composites to utilize case 'video': case 'image': // my parent is some sort of composite // only include me if I'm the first child if ($parent != NULL) { $children = $parent->children(); if (sizeof($children)) { $first_child = $children[0]; if (!($first_child == $child || $first_child->asXML() == $child->asXML())) { return $neg_one; } } } } if ($parent != NULL) { $result += floatval((string) $parent['start']); } } return $result; }