本文整理汇总了C++中VideoDecoder::IsKeyFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoDecoder::IsKeyFrame方法的具体用法?C++ VideoDecoder::IsKeyFrame怎么用?C++ VideoDecoder::IsKeyFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoDecoder
的用法示例。
在下文中一共展示了VideoDecoder::IsKeyFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecVideo
//.........这里部分代码省略.........
//Create video decorder for codec
videoDecoder = VideoCodecFactory::CreateDecoder(type);
//Check
if (videoDecoder==NULL)
{
Error("Error creando nuevo decodificador de video [%d]\n",type);
//Delete packet
delete(packet);
//Next
continue;
}
}
//Check if we have lost the last packet from the previous frame by comparing both timestamps
if (ts>frameTime)
{
Debug("-lost mark packet ts:%u frameTime:%u\n",ts,frameTime);
//Try to decode what is in the buffer
videoDecoder->DecodePacket(NULL,0,1,1);
//Get picture
BYTE *frame = videoDecoder->GetFrame();
DWORD width = videoDecoder->GetWidth();
DWORD height = videoDecoder->GetHeight();
//Check values
if (frame && width && height)
{
//Set frame size
videoOutput->SetVideoSize(width,height);
//Check if muted
if (!muted)
//Send it
videoOutput->NextFrame(frame);
}
}
//Update frame time
frameTime = ts;
//Decode packet
if(!videoDecoder->DecodePacket(buffer,size,lost,packet->GetMark()))
{
//Check if we got listener and more than 1/2 seconds have elapsed from last request
if (listener && getDifTime(&lastFPURequest)>minFPUPeriod)
{
//Debug
Log("-Requesting FPU decoder error\n");
//Reset count
lostCount = 0;
//Request it
listener->onRequestFPU();
//Request also over rtp
rtp.RequestFPU();
//Update time
getUpdDifTime(&lastFPURequest);
//Waiting for refresh
waitIntra = true;
}
}
//Check if it is the last packet of a frame
if(packet->GetMark())
{
if (videoDecoder->IsKeyFrame())
Debug("-Got Intra\n");
//No frame time yet for next frame
frameTime = (DWORD)-1;
//Get picture
BYTE *frame = videoDecoder->GetFrame();
DWORD width = videoDecoder->GetWidth();
DWORD height = videoDecoder->GetHeight();
//Check values
if (frame && width && height)
{
//Set frame size
videoOutput->SetVideoSize(width,height);
//Check if muted
if (!muted)
//Send it
videoOutput->NextFrame(frame);
}
//Check if we got the waiting refresh
if (waitIntra && videoDecoder->IsKeyFrame())
//Do not wait anymore
waitIntra = false;
}
//Delete packet
delete(packet);
}
//Delete encoder
delete videoDecoder;
Log("<RecVideo\n");
}