WFUTError WFUTClient::getLocalList(const std::string &filename, ChannelFileList &files) { assert (m_initialised == true); if (parseFileList(filename, files)) { // printf("Error parsing local file list\n"); return WFUT_PARSE_ERROR; } return WFUT_NO_ERROR; }
FileTransfer::FileTransfer( const Tag* tag ) : Plugin( PluginFileTransfer ), m_type( Invalid ) { if( !tag || tag->xmlns() != XMLNS_JINGLE_FILE_TRANSFER ) return; std::string name = tag->name(); if( name == "description" ) { const Tag* c = tag->findTag( "description/offer|description/request" ); if( c ) { parseFileList( c->findChildren( "file" ) ); name = c->name(); } } else if( name == "checksum" || name == "abort" || name == "received" ) { parseFileList( tag->findChildren( "file" ) ); } m_type = (Type)util::lookup( name, typeValues ); }
bool VirtualKinectCapture::open(std::string filelist) { if (!bOpened_) { bOpened_ = parseFileList(filelist); if (bOpened_) { if ((depthFileType_ == VK_DEPTH_FILE_VIDEO) && depthCapture_.open(depthFile_[0])) { showVideoInfo(depthCapture_); frameCount_ = depthCapture_.get(CV_CAP_PROP_FRAME_COUNT); } else if (depthFileType_ == VK_DEPTH_FILE_IMAGE) { frameCount_ = depthFile_.size(); } bOpened_ = frameCount_ != 0; if ((colorFileType_ == VK_COLOR_FILE_VIDEO) && colorCapture_.open(colorFile_[0])) { bOpened_ = colorCapture_.get(CV_CAP_PROP_FRAME_COUNT) == frameCount_; if (!bOpened_) std::cerr << "Error: frame count of BGR images is not equal to that of depth maps !\n"; else { showVideoInfo(colorCapture_); bOpened_ = colorCapture_.get(CV_CAP_PROP_FOURCC) == depthCapture_.get(CV_CAP_PROP_FOURCC); if (!bOpened_) std::cerr << "The codecs of image video and depth video must be the same!\n"; } } else if (colorFileType_ = VK_COLOR_FILE_IMAGE) { bOpened_ = colorFile_.size() == frameCount_; if (!bOpened_) std::cerr << "Error: frame count of BGR images is not equal to that of depth maps !\n"; } } } return (bOpened_); }
void fileTransferThread::readyRead() { while( socket->bytesAvailable() ) { if(stream.isEmpty()) { streamHeader=socket->read(8-streamHeader.size()); if(streamHeader.size() < 8) return; memcpy(&streamSize, streamHeader.mid(4).data(), 4); } stream+=socket->read( streamSize-stream.size() ); if( streamSize > (quint32)stream.size() ) //packet is not full return; if( streamHeader.at(0) == ConnectionRequest ) { qDebug()<<"ConnectionRequest"; estabilishFileTransfering( stream ); } else if( streamHeader.at(0) == ConnectionRequestAck) { qDebug()<<"ConnectionRequestAck"; } else if( streamHeader.at(0) == FileList) { qDebug()<<"FileList"; parseFileList( stream ); } else if( streamHeader.at(0) == FileListAck) { qDebug()<<"FileListAck"; } else if( streamHeader.at(0) == FileRequest) { qDebug()<<"FileRequest"; sendFile( stream ); } else if( streamHeader.at(0) == FileData) { qDebug()<<"FileData"; parseWriteData( stream ); } else if( streamHeader.at(0) == EndOfFile) { qDebug()<<"EndOfFile"; parseEndOfFile(); } else if( streamHeader.at(0) == TransferAbort) { qDebug()<<"TransferAbort"; } else { qDebug()<<"Unknown type"; } stream.clear(); streamHeader.clear(); } }