当前位置: 首页>>代码示例>>C++>>正文


C++ readFrame函数代码示例

本文整理汇总了C++中readFrame函数的典型用法代码示例。如果您正苦于以下问题:C++ readFrame函数的具体用法?C++ readFrame怎么用?C++ readFrame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了readFrame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runningLock

	void
	V4LFrameSource::run() {
		RecursiveMutexLock runningLock(m_runningMutex);
		
		int64_t frameTS = -1;
		int64_t lastFrameTS = -1;
		
		while (m_isRunning) {
			runningLock.unlock();

			try {
				FramePtr frame(new Frame());

				readFrame(frame.get());
				
				frameTS = frame->getTimestamp();

				{
					RecursiveMutexLock framePtrLock(m_framePtrMutex);
					m_lastFrame = frame;
				}

				emitFrame(frame);

				lastFrameTS = frameTS;
			} catch (EOFException e) {
				break;
			} catch (IOException e) {
				std::cout << "ERROR: " << e.what() << std::endl;
			}

			runningLock.lock();
		}
	}
开发者ID:pfrommerd,项目名称:vlab,代码行数:34,代码来源:V4LFrameSource.cpp

示例2: IdleCallback

void IdleCallback()
{
	XnStatus nRetVal = XN_STATUS_OK;
	if (g_bPause != TRUE)
	{
		// read a frame
		readFrame();
        
		// capture if needed
		nRetVal = captureFrame();
		if (nRetVal != XN_STATUS_OK)
		{
			displayMessage("Error capturing frame: '%s'", xnGetStatusString(nRetVal));
		}
        
		// add to statistics
		//statisticsAddFrame();
	}
    
	if (g_bStep == TRUE)
	{
		g_bStep = FALSE;
		g_bPause = TRUE;
	}
    
	glutPostRedisplay();
}
开发者ID:mpweinge,项目名称:KinectHandTracker,代码行数:27,代码来源:main.cpp

示例3: assert

uint32_t TFramedTransport::readSlow(uint8_t* buf, uint32_t len) {
  uint32_t want = len;
  uint32_t have = rBound_ - rBase_;

  // We should only take the slow path if we can't satisfy the read
  // with the data already in the buffer.
  assert(have < want);

  // If we have some data in the buffer, copy it out and return it.
  // We have to return it without attempting to read more, since we aren't
  // guaranteed that the underlying transport actually has more data, so
  // attempting to read from it could block.
  if (have > 0) {
    memcpy(buf, rBase_, have);
    setReadBuffer(rBuf_.get(), 0);
    return have;
  }

  // Read another frame.
  if (!readFrame()) {
    // EOF.  No frame available.
    return 0;
  }

  // TODO(dreiss): Should we warn when reads cross frames?

  // Hand over whatever we have.
  uint32_t give = std::min(want, static_cast<uint32_t>(rBound_ - rBase_));
  memcpy(buf, rBase_, give);
  rBase_ += give;
  want -= give;

  return (len - want);
}
开发者ID:alkeshpatel11,项目名称:libthrift,代码行数:34,代码来源:TBufferTransports.cpp

示例4: openCommon

int openCommon(openni::Device& device, DeviceConfig config)
{
    g_pPlaybackControl = g_device.getPlaybackControl();

    int ret;

    ret = openStream(device, "depth", openni::SENSOR_DEPTH, config.openDepth, g_depthStream, &g_depthSensorInfo, &g_bIsDepthOn);
    if (ret != 0)
    {
        return ret;
    }

    ret = openStream(device, "color", openni::SENSOR_COLOR, config.openColor, g_colorStream, &g_colorSensorInfo, &g_bIsColorOn);
    if (ret != 0)
    {
        return ret;
    }

    ret = openStream(device, "IR", openni::SENSOR_IR, config.openIR, g_irStream, &g_irSensorInfo, &g_bIsIROn);
    if (ret != 0)
    {
        return ret;
    }

    initConstants();

    readFrame();

    return 0;
}
开发者ID:higuchi-yuuki,项目名称:OpenNI2,代码行数:30,代码来源:Device.cpp

示例5: recvframe

void AdminConnection::processLogin(){
  InputFrame::Ptr recvframe( new InputFrame(version, paddingfilter) );
  if (readFrame(recvframe)) {
    try {
      if(recvframe->getType() == ft02_Login){
        std::string username, password;

        if ( getAuth( recvframe, username, password ) ) {

          bool authenticated = false;
          try{
            if(username == Settings::getSettings()->get("admin_user") && password == Settings::getSettings()->get("admin_pass"))
              authenticated = true;
          }catch(std::exception e){
          }
          if(authenticated){
            sendOK( recvframe, "Welcome" );
            INFO("Admin login ok by %s", username.c_str());
            logextid = Logger::getLogger()->addLog( LogSink::Ptr( new AdminLogger( boost::dynamic_pointer_cast<AdminConnection>(shared_from_this()) ) ) );
            status = READY;
          } else {
            throw FrameException( fec_FrameError, "Admin Login Error - bad username or password"); // TODO - should be a const or enum, Login error
          }
        }

      }else{
        throw FrameException( fec_FrameError, "Wrong type of frame in this state, wanted login");
      }
    } catch ( FrameException& exception ) {
      // This might be overkill later, but now let's log it
      DEBUG( "AdminConnection caught FrameException : %s", exception.what() );
      sendFail( recvframe, exception.getErrorCode(), exception.getErrorMessage() );
    }
  }
}
开发者ID:glew,项目名称:tpserver-cpp,代码行数:35,代码来源:adminconnection.cpp

示例6: frame

void AdminConnection::processNormalFrame()
{
  InputFrame::Ptr frame( new InputFrame(version,paddingfilter) );
  if (readFrame(frame)) {
    try {
      switch (frame->getType()) {
        case ftad_CommandDesc_Get:
          processDescribeCommand(frame);
          break;
        case ftad_CommandTypes_Get:
          processGetCommandTypes(frame);
          break;
        case ftad_Command:
          processCommand(frame);
          break;
        default:
          WARNING("AdminConnection: Discarded frame, not processed, was type %d", frame->getType());
          throw FrameException( fec_ProtocolError, "Did not understand that frame type.");
          break;
      }
    } catch ( FrameException& exception ) {
      // This might be overkill later, but now let's log it
      DEBUG( "AdminConnection caught FrameException : %s", exception.what() );
      sendFail( frame, exception.getErrorCode(), exception.getErrorMessage() );
    }
  } else {
    DEBUG("noFrame :(");
    // client closed
  }
}
开发者ID:glew,项目名称:tpserver-cpp,代码行数:30,代码来源:adminconnection.cpp

示例7: ASSERT

StackVisitor::StackVisitor(CallFrame* startFrame, VM* vm)
{
    m_frame.m_index = 0;
    m_frame.m_isWasmFrame = false;
    CallFrame* topFrame;
    if (startFrame) {
        ASSERT(vm);
        ASSERT(!vm->topCallFrame || reinterpret_cast<void*>(vm->topCallFrame) != vm->topEntryFrame);

        m_frame.m_entryFrame = vm->topEntryFrame;
        topFrame = vm->topCallFrame;

        if (topFrame && topFrame->isStackOverflowFrame()) {
            topFrame = topFrame->callerFrame(m_frame.m_entryFrame);
            m_topEntryFrameIsEmpty = (m_frame.m_entryFrame != vm->topEntryFrame);
            if (startFrame == vm->topCallFrame)
                startFrame = topFrame;
        }

    } else {
        m_frame.m_entryFrame = 0;
        topFrame = 0;
    }
    m_frame.m_callerIsEntryFrame = false;
    readFrame(topFrame);

    // Find the frame the caller wants to start unwinding from.
    while (m_frame.callFrame() && m_frame.callFrame() != startFrame)
        gotoNextFrame();
}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:30,代码来源:StackVisitor.cpp

示例8: llclose_transmitter

int llclose_transmitter(int fd) {
    info->tentativas = tentativas;

    while(info->tentativas > 0) {
        buildFrame(info->flag, "disc");
        transmitirFrame(info->frameSend, info->frameSendLength);
        start_alarm();

        info->frameTempLength = readFrame(info->frameTemp);
        char * type = malloc(5);
        type = verifyFrameType(info->frameTemp);
        if (verifyFrame(info->frameTemp, info->frameTempLength, "disc")) {
            buildFrame(info->flag, "ua");
            if(transmitirFrame(info->frameSend, info->frameSendLength))
                break;
        }
    }

    if (info->tentativas == 0) {
        printf("Número de tentativas chegou ao fim. \n");
        exit(-1);
    }

    sleep(1);
    if ( tcsetattr(info->fd,TCSANOW,&info->oldtio) == -1) {
        perror("tcsetattr");
        return -1;
    }
    close(fd);
    printf("fechou transmissor\n");
    return 1;
}
开发者ID:joaoDavidGB,项目名称:RCOM,代码行数:32,代码来源:link_layer.c

示例9: while

void ofxColorStream ::threadedFunction()
{
	while (isThreadRunning())
	{
		readFrame();
	}
}
开发者ID:eranws,项目名称:ofxOpenNi2,代码行数:7,代码来源:ofxColorStream.cpp

示例10: AVG_ASSERT

FrameAvailableCode SyncVideoDecoder::getRenderedBmps(vector<BitmapPtr>& pBmps, 
        float timeWanted)
{
    AVG_ASSERT(getState() == DECODING);
    ScopeTimer timer(RenderToBmpProfilingZone);
    FrameAvailableCode frameAvailable;
    if (timeWanted == -1) {
        readFrame(m_pFrame);
        frameAvailable = FA_NEW_FRAME;
    } else {
        frameAvailable = readFrameForTime(m_pFrame, timeWanted);
    }
    if (frameAvailable == FA_USE_LAST_FRAME || isEOF()) {
        return FA_USE_LAST_FRAME;
    } else {
        allocFrameBmps(pBmps);
        if (pixelFormatIsPlanar(getPixelFormat())) {
            ScopeTimer timer(CopyImageProfilingZone);
            for (unsigned i = 0; i < pBmps.size(); ++i) {
                m_pFrameDecoder->copyPlaneToBmp(pBmps[i], m_pFrame->data[i],
                        m_pFrame->linesize[i]);
            }
        } else {
            m_pFrameDecoder->convertFrameToBmp(m_pFrame, pBmps[0]);
        }
        return FA_NEW_FRAME;
    }
}
开发者ID:hoodie,项目名称:libavg,代码行数:28,代码来源:SyncVideoDecoder.cpp

示例11: assert

uint32_t TFramedTransport::readSlow(uint8_t* buf, uint32_t len) {
  uint32_t want = len;
  uint32_t have = rBound_ - rBase_;

  // We should only take the slow path if we can't satisfy the read
  // with the data already in the buffer.
  assert(have < want);

  // Copy out whatever we have.
  if (have > 0) {
    memcpy(buf, rBase_, have);
    want -= have;
    buf += have;
  }

  // Read another frame.
  if (!readFrame()) {
    // EOF.  No frame available.
    return 0;
  }

  // TODO(dreiss): Should we warn when reads cross frames?

  // Hand over whatever we have.
  uint32_t give = std::min(want, static_cast<uint32_t>(rBound_ - rBase_));
  memcpy(buf, rBase_, give);
  rBase_ += give;
  want -= give;

  return (len - want);
}
开发者ID:longcongduoi,项目名称:Thrift_ASIO,代码行数:31,代码来源:TBufferTransports.cpp

示例12: readFrame

int KitSocket::read(char *data, int len)
{
	sflap_frame frame;
	int i = readFrame(frame);
	if(i != -1) memcpy( (void *)data, (void *)frame.data, len );
	return i;
}
开发者ID:icefox,项目名称:kinkatta,代码行数:7,代码来源:kitsocket.cpp

示例13: printf

// ######################################################################
void SerialPort::connect() {
  // Check to see if we have a hardcoded device name. If so, then let's just
  // go ahead and enable that port. If
  printf("INFO: Looking Device Name [%s]\n", itsDevName.c_str());
  if (itsDevName != "") {
    printf("INFO: Opening %s\n", itsDevName.c_str());
    enablePort(itsDevName);
  } else if (itsDevName == "search") {
    printf("INFO: Searching for devices\n");
    itsCmdDevName = "";

    DIR *directory_p;
    struct dirent *entry_p;

    // Open the device directory to search for devices whose names match the
    // search prefix
    directory_p = ::opendir("/dev");
    if (directory_p == NULL)
      printf("FATAL ERROR: Could Not Open /dev Directory!\n");

    // Iterate through the directory entries
    while ((entry_p = ::readdir(directory_p))) {
      std::string entryName(entry_p->d_name);
      if (entryName.find(itsSearchPrefix.c_str()) !=
          std::string::npos) {  // If the directory entry name matches our
                                // search prefix, then let's try configuring a
                                // serial
        // port on that device, sending it an identity request command (0x00),
        // and comparing the result
        // with our required device description

        enablePort("/dev/" + entryName);
        unsigned char cmd[1] = {0};

        write(cmd, 1);
        std::vector<unsigned char> deviceStringVec = readFrame(cmd[0], 255);

        std::string deviceString(deviceStringVec.begin(),
                                 deviceStringVec.end());
        printf("INFO: %s : %s", entryName.c_str(), deviceString.c_str());

        if (deviceString == itsDeviceDescription) {
          itsCmdDevName = "/dev/" + entryName;
          break;
        }
      }
    }
    (void)::closedir(directory_p);
    if (itsCmdDevName == "") {
      printf(
          "FATAL ERROR: Could Not Find Serial Device Matching Descriptor "
          "(%s)\n",
          itsDeviceDescription.c_str());
    }
  } else {
    printf("INFO: Opening from cmd line %s\n", itsCmdDevName.c_str());
    enablePort(itsCmdDevName);
  }
}
开发者ID:sonia-auv,项目名称:provider_sonar,代码行数:60,代码来源:Serial.cpp

示例14: openCamera

void FFmpegVideo::init(const QString &dev)
{
    openCamera(dev);

    connect(m_timer, SIGNAL(timeout()), this, SLOT(readFrame()));
    m_timer->start(100);

}
开发者ID:thewon86,项目名称:ffmpeg_camera,代码行数:8,代码来源:ffmpegvideo.cpp

示例15: pcd

clams::Cloud::Ptr clams::StreamSequenceBase::getCloud(size_t idx) const
{
  Cloud::Ptr pcd(new Cloud);
  Frame frame;
  readFrame(idx, &frame);
  proj_.frameToCloud(frame, pcd.get());
  return pcd;
}
开发者ID:dcanelhas,项目名称:clams,代码行数:8,代码来源:stream_sequence_base.cpp


注:本文中的readFrame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。