本文整理汇总了C++中VideoFrame::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoFrame::clear方法的具体用法?C++ VideoFrame::clear怎么用?C++ VideoFrame::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoFrame
的用法示例。
在下文中一共展示了VideoFrame::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void VideoThr::run()
{
bool skip = false, paused = false, oneFrame = false, useLastDelay = false, lastOSDListEmpty = true, maybeFlush = false;
double tmp_time = 0.0, sync_last_pts = 0.0, frame_timer = -1.0, sync_timer = 0.0;
QMutex emptyBufferMutex;
VideoFrame videoFrame;
unsigned fast = 0;
int tmp_br = 0, frames = 0;
canWrite = true;
while (!br)
{
if (deleteFrame)
{
videoFrame.clear();
frame_timer = -1.0;
deleteFrame = false;
}
if (doScreenshot && !videoFrame.isEmpty())
{
QMetaObject::invokeMethod(this, "screenshot", Q_ARG(VideoFrame, videoFrame));
doScreenshot = false;
}
const bool mustFetchNewPacket = !filters.readyRead();
playC.vPackets.lock();
const bool hasVPackets = playC.vPackets.canFetch();
if (maybeFlush)
maybeFlush = playC.endOfStream && !hasVPackets;
if ((playC.paused && !oneFrame) || (!(maybeFlush || hasVPackets) && mustFetchNewPacket) || playC.waitForData)
{
if (playC.paused && !paused)
{
QMetaObject::invokeMethod(this, "pause");
paused = true;
frame_timer = -1.0;
}
playC.vPackets.unlock();
tmp_br = tmp_time = frames = 0;
skip = false;
fast = 0;
if (!playC.paused)
waiting = playC.fillBufferB = true;
emptyBufferMutex.lock();
playC.emptyBufferCond.wait(&emptyBufferMutex, MUTEXWAIT_TIMEOUT);
emptyBufferMutex.unlock();
if (frame_timer != -1.0)
frame_timer = gettime();
continue;
}
paused = waiting = false;
Packet packet;
if (hasVPackets && mustFetchNewPacket)
packet = playC.vPackets.fetch();
else
packet.ts.setInvalid();
playC.vPackets.unlock();
if (playC.nextFrameB)
{
skip = playC.nextFrameB = false;
oneFrame = playC.paused = true;
fast = 0;
}
playC.fillBufferB = true;
/* Subtitles packet */
Packet sPacket;
playC.sPackets.lock();
if (playC.sPackets.canFetch())
sPacket = playC.sPackets.fetch();
playC.sPackets.unlock();
mutex.lock();
if (br)
{
mutex.unlock();
break;
}
/* Subtitles */
const double subsPts = playC.frame_last_pts + playC.frame_last_delay - playC.subtitlesSync;
QList<const QMPlay2_OSD *> osdList, osdListToDelete;
playC.subsMutex.lock();
if (sDec) //Image subs (pgssub, dvdsub, ...)
{
if (!sDec->decodeSubtitle(sPacket, subsPts, subtitles, W, H))
{
osdListToDelete += subtitles;
subtitles = NULL;
}
}
else
{
if (!sPacket.isEmpty())
//.........这里部分代码省略.........