private function findNearestKeyframeMark($mark, $direction) { $q = new Query(sprintf("select mark\n from recordedseek \n where chanid = :chanid\n and starttime = :starttime\n and type = 9\n and mark %s :mark1\n and mark %s :mark2\n order by abs(:mark1 - mark) limit 1", $direction < 0 ? '<=' : '>=', $direction < 0 ? '>=' : '<=')); $q->chanid = $this->chanid; $q->starttime = date('Y-m-d H:i:s', $this->starttime); $q->mark1 = $mark; $q->mark2 = $mark + ($direction < 0 ? -1 : 1) * 100; return $q->Result(); }