Example #1
0
	void step(const boost::system::error_code &e)
	{
		if (e)
			return;

		if (cv::waitKey(1) >= 0)
		{
			utils::stopAllServices();
			return;
		}

		// get frame
		//int64_t now = mTimer.getTime() - mPlayTime;
		//ZZLAB_STEP();
		//AVFrame* frame = videoFrameQ.dequeue(now);
		//if (frame)
		//{
		//	//ZZLAB_TRACE_VALUE(frame);
		//	//cv::Mat1b gray(frame->height, frame->width, frame->data[0], frame->linesize[0]);
		//	//cv::Mat3b img;
		//	//cv::cvtColor(gray, img, CV_GRAY2BGR);
		//	//cv::imshow("Image", img);
		//	//av_frame_free(&frame);
		//	{
		//		delete[] frame->data[0];
		//		delete frame;
		//	}
		//}

		mUITimer.expires_from_now(boost::posix_time::milliseconds(10));
		mUITimer.async_wait(boost::bind(&Test0::step, this, boost::asio::placeholders::error));
	}
Example #2
0
 void refresh_timeout_timer() {
     timeout_timer.cancel(); 
     timeout_timer.expires_from_now(posix_time::milliseconds(1000));
     timeout_timer.async_wait([&](const boost::system::error_code& e){ 
             // function to be run at timeout
             timeout(e); });
     return;
 }
Example #3
0
  void start_timer()
  {
    timer.expires_from_now(boost::posix_time::milliseconds(100));
    timer.async_wait([this] (const asio::error_code &err) {
        if (err) {
          LOG(ERROR) << "Timer error: " << err;
          return;
        }

        sys_check_timeouts();
        start_timer();
      });
  }
Example #4
0
 // Helper function to get a timer's expiry time.
 static asio::deadline_timer::time_type expiry(
     const asio::deadline_timer& timer)
 {
   return timer.expires_at();
 }
Example #5
0
timer() : t(io_context) { t.expires_at(boost::posix_time::pos_infin); }