本文整理汇总了C++中FramePtr::sourceFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::sourceFrame方法的具体用法?C++ FramePtr::sourceFrame怎么用?C++ FramePtr::sourceFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::sourceFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendFrame
/**
* @brief
*
* @param writeable
* @param frame
*
* @return
*/
bool HttpImageStream::sendFrame( Select::CommsList &writeable, FramePtr frame )
{
const ByteBuffer &packet = frame->buffer();
std::string txHeaders = "--imgboundary\r\n";
txHeaders += "Content-Type: image/jpeg\r\n";
txHeaders += stringtf( "Content-Length: %zd\r\n\r\n", packet.size() );
ByteBuffer txBuffer;
txBuffer.reserve( packet.size()+128 );
txBuffer.append( txHeaders.c_str(), txHeaders.size() );
txBuffer.append( packet.data(), packet.size() );
txBuffer.append( "\r\n", 2 );
for ( Select::CommsList::iterator iter = writeable.begin(); iter != writeable.end(); iter++ )
{
if ( TcpInetSocket *socket = dynamic_cast<TcpInetSocket *>(*iter) )
{
if ( socket == mConnection->socket() )
{
int nBytes = socket->write( txBuffer.data(), txBuffer.size() );
const FeedFrame *sourceFrame = frame->sourceFrame();
Debug( 4, "Wrote %d bytes on sd %d, frame %ju<-%ju", nBytes, socket->getWriteDesc(), frame->id(), sourceFrame->id() );
if ( nBytes != txBuffer.size() )
{
Error( "Incomplete write, %d bytes instead of %zd", nBytes, packet.size() );
mStop = true;
return( false );
}
}
}
}
return( true );
}