本文整理汇总了C++中MediaStream::needData方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaStream::needData方法的具体用法?C++ MediaStream::needData怎么用?C++ MediaStream::needData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaStream
的用法示例。
在下文中一共展示了MediaStream::needData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
MediaStream::readCallback ( void* data, const char* cookie, int64_t* dts, int64_t* pts, unsigned* flags, size_t* bufferSize, void** buffer )
{
Q_UNUSED(cookie);
Q_UNUSED(dts);
Q_UNUSED(pts);
Q_UNUSED(flags);
MediaStream* that = static_cast < MediaStream * > ( data );
qint64 bufsize = 0;
*bufferSize = 0;
if ( that->m_eos == true ) {
return -1;
}
if ( that->m_type == Stream ) {
bufsize = that->needData(buffer);
}
else if ( that->m_type == IODevice ) {
bufsize = that->m_ioDevice->read( that->m_buffer, BLOCK_SIZE );
*buffer = that->m_buffer;
}
if ( bufsize > 0 ) {
that->m_started = true;
}
if ( that->m_type == IODevice && bufsize == 0 && that->m_started && that->m_bufferingFinished == true ) {
that->m_eos = true;
return -1;
}
if ( bufsize < 0 ) {
that->m_eos = true;
return -1;
}
*bufferSize = bufsize;
return 0;
}